June 2018
Beginner to intermediate
376 pages
8h 58m
English
We are going to take our existing LoginPage class and convert it to one backed by the Selenium PageFactory class. Let's start with the most common annotation that is in use, the @FindBy annotation. You have a couple of options when it comes to defining them:
@FindBy(how = How.ID, using = "username")private WebElement usernameField;@FindBy(id = "username")private WebElement usernameField;
The preceding two examples are functionally equivalent and both are correct; it doesn’t matter which one you decide to use.
I personally prefer the first option; I have configured a live template in IntelliJ that creates the annotation and allows me to just press cmd + J (or Ctrl + J if you are not using OS X) and then . (period) ...
Read now
Unlock full access