I have a RecyclerView (R.id.recyclerView) where each row has an image (R.id.row_image) and a TextView. I want to click on the image in the first row.
I\'ve tried to use
Just to add to Gabor's answer (which is the correct and complete answer since Espresso 2.0).
You may encounter problems at the moment when using espresso-contrib
and RecyclerView
s (see android-test-kit ticket).
A workaround is to add this exclusion in the espresso-contrib
dependency Gabor mentioned above:
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.0') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
(This is an answer instead of a comment to Gabor's answer because I don't have the right to post comments yet)