July 2019
Intermediate to advanced
536 pages
12h 57m
English
In cases where features change drastically and the use of a multilocator definition doesn't work, users can declare different sets of controls and add conditional code checks into methods to perform different sets of actions.
As an example, say a feature is changed from using an input field to enter a value, to using a select field to select a value from a predefined drop-down list; the method would have to perform a sendKeys event for the input field, and a select event for the select field. A condition can be added to the method to check for the existence of one of the fields and perform the correct action based on the result.
Let's look at an example:
// locators@FindBy(css = "input[id='myUser']")protected M myUser;@FindBy(css ...
Read now
Unlock full access