Work with UI elements using XPath

XPath is a specification standardized by W3C for identifying UI elements displayed by a web or mobile application. Automation scripts, whether written for Selenium, Appium, Perfecto Automation, or any other supported framework, can use this specification to automate actions on specific UI elements. Support for XPath 2.0 can vary by framework. In Appium-based tests, the iOS XCUITest and Android UIAutomator2 drivers can evaluate some locators with XPath 1.0 behavior, so some XPath 2.0 expressions may not be supported in all scenarios.

When you generate locators with Perfecto Object Spy, validate them in the same framework and environment where your test runs. For known limitations and workarounds, see XPath 2.0 updates and workarounds and XPath 2.0 tips.

In this section: