July 2018
Intermediate to advanced
280 pages
7h 27m
English
An element in the PageObject is marked with the @FindBy annotation. It is used to direct the WebDriver to locate that element on a page. It takes the locating mechanism (that is, by Id, Name, or Class Name) and the value of the element for that locating mechanism as input.
There are two ways of using the @FindBy annotation:
Usage 1 is shown as follows:
@FindBy(id="user_login")WebElement userId;
Usage 2 is shown as follows:
@FindBy(how=How.ID, using="user_login")WebElement userId;
The preceding two usages direct the WebDriver to locate the element using the locating mechanism ID with the user_login value and assign that element to the userId WebElement. In usage 2, we have used the How enumeration. This enumeration ...
Read now
Unlock full access