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 the native automation framework to identify UI elements. Prefer UiSelector on Vega: in testing it resolved elements about 10 times faster than the equivalent XPath query, and it’s the only strategy that can scope a lookup to a subtree (see Find an element within a parent). Pass a JSON string with anargs object whose keys match the element’s attributes in the UI Component Compositor (UCC) tree.
Example usage:
Accepted args keys
Find multiple elements
Use the multi-element form to return every match, then filter in your test code.Find an element within a parent
To locate a child within a known parent, call the find method on the parent element. This runs a parent-scoped lookup (findElementFromElement). XPath doesn’t work in this position, so UiSelector is the only way to scope a search to a subtree.
XPath
A query language that enables navigation and selection of elements in an XML-like structure. Example usage:Supported XPath forms
Appium Vega Driver evaluates a single node test with an optional predicate against the app’s element tree. The tree has a<root> element whose descendants are <child> nodes.
The driver supports the following forms:
Comparison of selector strategies
Best practices
-
Choose the right strategy
- Use UiSelector for platform-specific tests
- Use XPath for cross-platform compatibility
- Prefer UiSelector when performance is critical
-
Element location
- Use unique identifiers when possible
- Avoid absolute paths
- Keep selectors as simple as possible
- Regularly validate selectors’ reliability
-
Performance considerations
- Complex XPath queries may impact test execution time
- Cache frequently used elements
- Use app-specific IDs when available
-
Maintenance tips
- Document locator strategies
- Review locators regularly
- Update with UI changes
- Maintain cross-platform compatibility
- Use meaningful names in test code

