How to fetch a list item count in a scrollable list

I have test case where i have to automate a filter result and i’m asserting filter result by count of filter results for particular filter and filter i’m applying is giving result in a scrollable list.

Solution i’m looking for:

  • How to get unique count of list item from the scrollable list ?

  • Parent layout is “android.support.v7.widget.RecyclerView” and list items are inside recyclerview in a ‘android.widget.LinearLayout’

  • There are no unique identifiers like index for each linearlayout to get the count of list items through index.

  • There are no unique identifier to know where to end the scolling.

Please do suggest an approach or solution i should go with.

General solution: As far as with Android you can not see anything outside screen (with Automator) make your search result always 100% fit screen your test phone. So you can easy caclulate them.

UiAutomator2 has a setting called ignoreUnimportantViews. By setting it to false you will be able to see previously invisible off-screen elements (and count them). With Espresso driver the task might even be easier since it provides the access to application method calls (check the documentation on “mobile: backdoor” call)

by default it is already “false” :slight_smile: