Skip to content

Instantly share code, notes, and snippets.

@nathankrishnan
Last active February 10, 2023 12:38
Show Gist options
  • Save nathankrishnan/973a8e093e6e50ac58cab84fe83ceef0 to your computer and use it in GitHub Desktop.
Save nathankrishnan/973a8e093e6e50ac58cab84fe83ceef0 to your computer and use it in GitHub Desktop.
Appium - Common Locator Strategies
Locator Strategy Description
Id Finds an element by the id attribute on iOS and resource-id attribute on Android.
Accessibility ID Finds an element by the accessibility-id attribute on iOS and the content-desc attribute on Android
Class Name Finds an element by its XCUIElementType on iOS and by the widget name on Android. For example, a button class would be XCUIElementTypeButton in iOS and android.widget.Button in Android.
XPath Finds an element by its position in the XML representation of the View Hierarchy.
Android UiSelector An Android-specific strategy for finding an element using Android’s UiSelector API.
iOS Predicate String An iOS-specific strategy for finding an element using iOS's Predicate Format String Syntax.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment