Finding and interacting with elements
Appium supports a subset of the WebDriver locator strategies:
- find by "class" (i.e., ui component type)
- find by "xpath" (i.e., an abstract representation of a path to an element, with certain constraints)
Appium additionally supports some of the Mobile JSON Wire Protocol locator strategies
-ios uiautomation: a string corresponding to a recursive element search using the UIAutomation library (iOS 9.3 and below only)
-android uiautomator: a string corresponding to a recursive element search using the UiAutomator Api (Android-only)
accessibility id: a string corresponding to a recursive element search using the Id/Name that the native Accessibility options utilize.
There's a known issue with table cell elements becoming invalidated before there's time to interact with them. We're working on a fix
Using Appium Desktop To Locate Elements
Appium provides you with a neat tool that allows you to find the the elements you're looking for. With Appium Desktop you can find any element and its locators by either clicking the element on the screenshot image, or locating it in the source tree.
Appium Desktop has a simple layout, complete with a source tree, a screenshot, and record and refresh buttons, and interaction tools.
After launching Appium Desktop and starting a session, you can locate any element in the source. In this test, I'm looking for the accessibility id of the "Compute Sum" button.
To find the accessibility id of this button, I click the "Compute Sum" button in the screenshot. The element is then highlighted in the source tree. In the panel on the right, I can see the accessibility id.