Introduction
Up to this point, we have discussed page object classes in relation to how they fit into the framework and follow a certain model. However, there has to be a way to define the objects on the page so we can test them. We will do this by inspecting the DOM or mobile elements as they appear on a page.
Selenium uses a concept known as locators to define each element on a page. Locators are stored in each base and subclass, and define the element using one of the required DOM attributes, such as ID, class, name, tag, link text, CSS, XPath, and many more.
In this chapter, we will introduce the user to the use of inspectors for browsing page elements for both browser and mobile apps, some of the third-party tools available to test locators, the syntax to use when defining elements in the classes, and when to build a dynamic locator on the fly versus using a static cached one in the page object.
The reader will learn how to inspect elements in the application, how to define the elements...