
Selenium Design Patterns and Best Practices
By :

The largest advantage of the Page Object pattern is that it is not a zero-sum approach. That is, we do not need to convert the entire test suite to the Page Object framework to take advantage of it. Instead, we can slowly add new Page
subclasses as they are needed and updating the existing tests to use the newly created classes as they become available. For a while, our test suite might look like a hybrid of direct Selenium click
methods and the add_to_cart
methods from the framework. This is perfectly acceptable as long as our code is continuously improving in the positive direction.
In the following test examples, we are not using the The Action Wrapper pattern section from Chapter 5, Stabilizing the Tests. Thus, we have a mix of Selenium get
and click
method calls, and we are missing all of the stability improvements added in that chapter. This is done for both brevity and to demonstrate that the test suite can be improved in small portions...
Change the font size
Change margin width
Change background colour