Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
Locator strategies are methods used to find and identify user interface (UI) elements within an app during test automation. These strategies act as search patterns that tell Appium how to locate specific elements on the screen, such as buttons, text fields, or other UI components.

Supported strategies

Appium Vega Driver supports UiSelector and XML Path Language (XPath). This release doesn’t support other selector strategies.

UiSelector

A platform-specific locator strategy that uses native automation frameworks to identify UI elements. It provides precise control over element selection based on properties and hierarchical relationships. Example usage:

XPath

A query language that enables navigation and selection of elements in an XML-like structure. Example usage:

Key components

  1. Axis - Specifies the direction of the search, such as descendant, ancestor, and following.
  2. Node test - Specifies the node type to select, such as element, attribute, or text().
  3. Predicate - Filters the selected nodes that are based on various conditions, such as attribute values, position, or custom functions.

Special use cases

Comparison of selector strategies

Best practices

  1. Choose the right strategy
    • Use UiSelector for platform-specific tests
    • Use XPath for cross-platform compatibility
    • Prefer UiSelector when performance is critical
  2. Element location
    • Use unique identifiers when possible
    • Avoid absolute paths
    • Keep selectors as simple as possible
    • Regularly validate selectors’ reliability
  3. Performance considerations
    • Complex XPath queries may impact test execution time
    • Cache frequently used elements
    • Use app-specific IDs when available
  4. Maintenance tips
    • Document locator strategies
    • Review locators regularly
    • Update with UI changes
    • Maintain cross-platform compatibility
    • Use meaningful names in test code

Last modified on October 31, 2025