July 2019
Intermediate to advanced
536 pages
12h 57m
English
When we talk about defining all the elements on a page, there is a specific syntax that Selenium PageFactory provides the user to define those elements. That syntax is @FindBy, plus the locator, @CacheLookup, and an attribute name and scope for the element. There are various "standards" for which locator to use: ID, tag, name, class, attribute, CSS, XPath, and so on. For now, those standards will not be covered. The following example shows how to define common elements in the base class that would apply to all the pages in an application. Subclasses would inherit them when the class is instantiated:
// common WebElement locators included in base class@FindBy(css = "img[src*='myLogo.png']")@CacheLookupprotected M companyLogo; ...
Read now
Unlock full access