Reputation: 13
I am testing my Android application using Appium + robot framework.
because an android screen that doesn't have ids for these elements. So I used the xpath to find the elements then I can find the index1 success but index[3] can't find.
This is how the screen looks like in UI Automator Viewer:
my xpath:
input text xpath=//android.widget.EditText[1] xxx
input text xpath=//android.widget.EditText[3] xxx
Would appreciate any help.
Upvotes: 0
Views: 9730
Reputation: 20077
xpath=//android.widget.EditText[2]
The xpath reads "find all android.wdiget.EditText
and return the n-th matching node - in your case, the target one is the 2nd in the nodeset; you've mistaken the condition as the n-th chield of the parent node.
Plus, the position in xpath start from 1, not 0.
Upvotes: 0