Locator
Propertiesâ
name
â
This property will set the name of the WebElement. This property is required.
. . .
private final Locator loginButton = Locator.buildLocator ()
.web (By.id ("login-button"))
.name ("Login Button")
.build ();
. . .
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 ();
. . .
androidIndex
â
This property will set the index for the Android WebElement. If not provided, it will default use the value from index
property.
. . .
private final Locator title = Locator.buildLocator ()
.android (AppiumBy.className ("android.widget.TextView"))
.androidIndex (1)
.name ("Title")
.build ();
. . .
ios
â
This property will set iOS specific locator.
. . .
private final Locator loginButton = Locator.buildLocator ()
.web (By.id ("login-button"))
.ios (AppiumBy.accessibilityId ("test-LOGIN"))
.name ("Login Button")
.parent (this.loginBox)
.build ();
. . .
iosIndex
â
This property will set the index for the iOS WebElement. If not provided, it will default use the value from index
property.
. . .
private final Locator title = Locator.buildLocator ()
.ios (AppiumBy.className ("XCUIElementTypeStaticText"))
.iosIndex (1)
.name ("Title")
.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 be tha fallback index property. If the platform based index is not provided, then the framework will fallback to this index property 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 ();
. . .
web
â
This property will set Web specific locator.
. . .
private final Locator loginButton = Locator.buildLocator ()
.web (By.id ("login-button"))
.name ("Login Button")
.build ();
. . .
mac
â
This property will set Mac specific locator.
. . .
private final Locator loginButton = Locator.buildLocator ()
.mac (By.id ("login-button-mac"))
.name ("Login Button")
.build ();
. . .
macIndex
â
This property will set the index for the Mac WebElement. If not provided, it will default use the value from index
property.
. . .
private final Locator title = Locator.buildLocator ()
.mac (By.tagName ("h3"))
.macIndex (1)
.name ("Title")
.build ();
. . .
webIndex
â
This property will set the web index for the WebElement. If not provided, it will default use the value from index
property.
. . .
private final Locator title = Locator.buildLocator ()
.web (By.tagName ("h3"))
.webIndex (1)
.name ("Title")
.build ();
. . .
shadowRoot
â
This property will mark the element as shadow root element when set to true
.
. . .
private final Locator shadowParent = Locator.buildLocator ()
.web (By.tagName ("div"))
.shadowRoot (true)
.name ("Title")
.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 ();
. . .