I have an Android application which has a RecyclerView with N elements, and when this RecyclerView reaches to end when scrolling, then more elements are added (so, it\'s an
I use this ;
// Get total item of myRecyclerView
RecyclerView recyclerView = mActivityTestRule.getActivity().findViewById(R.id.myRecyclerView);
int itemCount = recyclerView.getAdapter().getItemCount();
Log.d("Item count is ", String.valueOf(itemCount));
// Scroll to end of page with position
onView(withId(R.id.myRecyclerView))
.perform(RecyclerViewActions.scrollToPosition(itemCount - 1));