DEV Community

Cover image for Selenium Page Factory
Anne Quinkenstein
Anne Quinkenstein

Posted on

Selenium Page Factory

how it works

FindBys - AND Condition

Eg: @FindBys({@FindBy(id = "foo"), @FindBy(className = "bar")})

HTML source code of a WebElement:

In POM:

@FindBys({
@FindBy(id = "searchId_1"),
@FindBy(name = "search_field")
})

WebElementSearchButton;

In the above example, the WebElement ‘SearchButton’ is located only if it matches both the criteria whose id value is “searchId_1” and the name value is “search_field”. Please note that the first criteria belong to a parent tag

and the second criteria for a child tag.

FindAll - OR Condition

@CacheLookUp

if a Webelement is approched several time, you can store it in cache

extended

Top comments (0)