问题
I'm using this line of code to perform a click on RecyclerView
's list at position
0.
onView(withId(R.id.rv)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
But it's not working and returns NoMatchingViewException
.
But, when I perform a click operation on TextView
(which is inside the RecyclerView
layout), it's working and testing is passing, as shown in the line of code below,
onView(allOf(result(withId(R.id.tv), 0), isDisplayed())).perform(click());
Am I using the RecyclerViewActions
correctly, and how do I resolve the issue?
来源:https://stackoverflow.com/questions/50852995/recyclerviewactions-returns-nomatchingviewexception-in-espresso-android-testing