Reputation: 1
I am Trying to automate an android
mobile application which has all same attributes
i.e. class
name,Text
,index.
I need to click the second
See all button in this screen
of the application.
The screen shot using the uiautomator
looks as follows:
There is a see All Link which has the same attributes as the second one
How can i find the element using findElement(By.name())
or By xpath??
Upvotes: 0
Views: 1840
Reputation: 2460
It's simple when all attributes has the same name as you say, try to select all elements by findElements(By.className("...."))
then add .get(0);
for the first and .get(1);
for the second this is the logic.
findElements(By.className("....")).get(i);
i : the index of the element you want
Upvotes: 1