Find the XPaths¶
After configuring your Appium session, you can start using it to find the addresses of UI elements in the Selendroid app.
1. Determine the Element's XPath¶
The app that we're using contains a UI element that allows the user to enter text. In this tutorial, we will use intaQt to automate this action.
Move your mouse over the Selendroid Test App text field
in the Appium desktop and click it:
Some XML will appear in Appium's middle section, and the right-hand section contains a table of attributes as well as three Find By
criteria, which can be used to address the element.
Use the element's XPath: //android.widget.EditText[@content-desc="my_text_fieldCD"]
.
2. Verify the XPath¶
Find which element the XPath belongs to by using the search function. Click the magnifying glass at the top of the Appium Desktop window select Locator Strategy
-> XPath
:
Enter the XPath from above and click Search
:
Appium Desktop returns one element for this search term. The element will also appear highlighted on the left-hand side of the window:
Write an XPath expression like //android.widget.Button
without specifying any other attribute, and Appium generates the following:
Note |
---|
Searching for a less-specific XPath may result in a list of matching elements XPath. For example, the Selendroid Test App uses six buttons. |
Use an index if you want to select a specific Element from the list without expression a specific condition about it. Using //android.widget.Button[2]
will allow us to iterate through a list of elements on the screen in intaQt.
Conclusion¶
Now that you have gained some insight into using Appium Desktop to find UI elements, we will go back to intaQt Studio and put together our test case.