Locator
Propertiesâ
android
â
This property will set Android specific locator.
. . .
private final Locator loginButton = Locator.buildLocator ()
.web (By.id ("login-button"))
.android (AppiumBy.accessibilityId ("test-LOGIN"))
.name ("Login Button")
.parent (this.loginBox)
.build ();
. . .
filter
â
This property will set the filter on the WebElement.
. . .
private final Locator title = Locator.buildLocator ()
.web (By.tagName ("h3"))
.filter (e -> e.getText ().contains ("Some Text"))
.name ("Title")
.build ();
. . .
index
â
This property will set the index for the WebElement.
. . .
private final Locator title = Locator.buildLocator ()
.web (By.tagName ("h3"))
.index (1)
.name ("Title")
.build ();
. . .
parent
â
This property will set the parent locator for the current WebElement.
. . .
private final Locator loginBox = Locator.buildLocator ()
.web (By.id ("login_button_container"))
.android (AppiumBy.accessibilityId ("test-Login"))
.name ("Login Box")
.build ();
private final Locator username = Locator.buildLocator ()
.web (By.id ("user-name"))
.android (AppiumBy.accessibilityId ("test-Username"))
.name ("User Name")
.parent (this.loginBox)
.build ();
. . .
waitStrategy
â
This property will set the wait strategy to apply while finding the element.
. . .
private final Locator username = Locator.buildLocator ()
.web (By.id ("user-name"))
.android (AppiumBy.accessibilityId ("test-Username"))
.name ("User Name")
.waitStrategy (WaitStrategy.CLICKABLE)
.build ();
. . .
web
â
This property will set Web specific locator.
. . .
private final Locator loginButton = Locator.buildLocator ()
.web (By.id ("login-button"))
.name ("Login Button")
.build ();
. . .
Methodsâ
getLocator
â
This method will get the locator for the platform the test is running for.
. . .
private final Locator username = Locator.buildLocator ()
.web (By.id ("user-name"))
.android (AppiumBy.accessibilityId ("test-Username"))
.name ("User Name")
.waitStrategy (WaitStrategy.CLICKABLE)
.build ();
. . .
By locatorElement = username.getLocator ();
. . .