Count the no.of items in recyclerview

I have a recyclerview which lists all the messages i have received in my inbox.How do i count the no .of messages present in the view and get their text as well.

It is impossible to do then with UiAutomator2 without scrolling the list to the end. Although, it can be done using Espresso. Check https://appiumpro.com/editions/95

Espresso will not help if we have laizy loading. End of list is our true way -:slight_smile:

How can i do it with scrolling in uiautomator2?

Can you help me with code of scrolling and counting here?

Below example is for the count:
int counter =0;
boolean firsttime =true;
while(true){
AndroidElement transactionlist = driver.findElementById(“com.finwizard.fisdom:id/transactionlist”);
List transactiontext = transactionlist.findElementsByClassName(“android.widget.TextView”);
System.out.println(transactiontext.get(counter).getText());
if(transactiontext.get(counter).getText().equalsIgnoreCase(“ICICI prudential Long Term”)){
break;
}
if(counter ==5){
if(firsttime){
counter= 0;
Horizontal.horizontalswipe();
}
}
counter++;
}

Read 5 rows at a time then scrolling for next five rows

how to identify end of list here

How would i make sure that the swipe function scrolls to next five rows

  1. use UiScrollable and scrollForward to scroll 100% per page view. example of using UiScrollable -> Unable to scroll backward using UiAutomator2 in android
  2. check text in each message and try to understand if it same or not. if you have some messages with same text = you do not have chance to count emails

I wonder if appium espresso driver currently support scrolling through the recycler view? I cannot find any example or any information about this.