January 2018
Beginner to intermediate
354 pages
7h 59m
English
When defining locators in the page object classes, a static name is always given to the WebElement or MobileElement. This name should be referenced in the methods in the class that act on the element. Methods can either directly call a Selenium API method on a static element, or take a WebElement or MobileElement as a parameter.
Using the Gmail login page again as an example, the email and password fields would look like this:
// use of static WebElement name in methodpublic void login(String email, String password) throws Exception { this.email.sendKeys(email); // static WebElement name this.password.sendKeys(password); // static WebElement name submit.click();}
// use of static WebElement name passed ...
Read now
Unlock full access