eBook – Improve Selenium Code with Page Object Models

One of the fundamental concepts for test automation, with Selenium WebDriver and other automation tools, is Page Object Model.

This is because it allows writing good code that is easy to understand and maintain:


public void testSuccessfulLogin() {

   LoginPage login = new LoginPage(driver);

   MainPage main = login.signInWith(EMAIL, PASSWORD);

   assertTrue(main.isUserSignedIn() == true);


Page Object Model can be summarized in a few bullet points:

  • create a page object class for each site page (example: HomePage.java for the home page)
  • the class implements all user interactions with the page
  • use objects of the page object class in tests every time you need to interact with the specific page

That’s the summary of it.


But is this all to Page Object Model?

If you read it carefully, you will see that it also mentions about

  • returning page objects from page methods
  • creating not only page object classes but also page element classes for page widgets


Also, Page Object Model has an extension named Page Factory that allows the page classes code to be simplified significantly.


And the page classes can be improved further using related automation patterns such as Loadable Component and Slow Loadable Component.


I am using all these daily in my automation work.


I thought that it is a good idea to gather all of them in a short ebook together with related concepts such as

  • how to create a base page class (no, I am not talking about utility classes)
  • what practices should be avoided in test automation for the Page Object Model


All these are the content of my newest ebook:

Improve Selenium Code with Page Object Models


See a preview of it here.


If you want the full ebook, please transfer USD 13 to alex@alexsiminiuc.com through Paypal.


Thank you.