How to click on a button within a recycler view item using espresso?

By : Vivek
Source: Stackoverflow.com
Question!

Just to take an example, say my recycler view(with id "list") is this Gmail Inbox

enter image description here

I already know onView(withId(R.id.list)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click()); let's me to open the second email.

But how do I just click on the star button of the second email with espresso ?

By : Vivek


Answers

Have a look at the following stackoverflow question: It creates a ViewAction that clicks a view object, identified by id, at a specific position in the recyclerView.

Using Espresso to click view inside RecyclerView item

By : JonnyL


This video can help you solving your question :)
By: admin