How to click on an item inside a RecyclerView in Espresso

前端 未结 10 2327
逝去的感伤
逝去的感伤 2020-12-01 05:33

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

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 05:53

    I followed @Gabor's answer but when I included the libraries, I hit the dex limit!

    So, I removed the libraries, added this getInstrumentation().waitForIdleSync(); and then just called onView(withId...))...

    Works perfectly.

    In your case you will have multiple image views with the same ID so you will have to figure out something on how you can select the particular list item.

提交回复
热议问题