O'Reilly logo

Selenium Testing Tools Cookbook - Second Edition by Unmesh Gundecha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the PageFactory class for exposing the elements on a page

To implement the Page Object model in tests, we need to create a Page Object class for each page that is being tested. For example, to test the BMI Calculator application, a BMI Calculator page class will be defined, which will expose the internals of the BMI Calculator page to the test, as shown in following diagram. This is done by using the PageFactory class of Selenium WebDriver API:

Using the PageFactory class for exposing the elements on a page

Getting ready

Before exposing the elements of a page, we need to do the following:

  • Identify the locators that will be needed to find all the required elements from a page uniquely
  • Define the structure of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required