简体   繁体   中英

Selendroid - How to click an item in an listview?

can anyone help on how to click an item in ListView using selendroid(language Java) ? i know using inspector we can know the ID of an element, but in listview all the items are having the same id.. Can someone please help me on this ..

Thanks in advance.

You can grab elements in other way, like XPath or value.

driver.findElement(By.xpath("(//ListView/OtherTag)[3]"));

For testing XPath, you can use inspector after start selendroid-standalone.

First get all the elements into a list -

List<WebElement> we = driver.findElements(By.yourLocator);

Now, you can iterate over the list either using foreach loop or using index of the list

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM