How to get element count from a Mobile App


How to get element count from mobile app?
I have ‘resource-id’ element property is same for some group of objects of a mobile app. I want to get the count with same property and get the ‘text’ of each element by looping it.
But I couldn’t see any such keyword in Mobile.

Please help me to resolve this issue.

Ravi B

Hi @ravi.b23,

Please try this:

println MobileDriverFactory.getDriver().findElementsById("value").size()

or this:

println MobileDriverFactory.getDriver().findElementsByXPath("//**[@resource-id='value']").size()

Hi duyluong, I am only getting element count which is visible on screen. It’s list of element so only visible one count I am getting how to get count of all elements with same Id.