Click on not fully visible imageButton with Espresso

前端 未结 7 1118
臣服心动
臣服心动 2021-01-31 09:05

I have a custom ImageButton that is not fully visible, by design, so when I perform a click action I get this error:

android.support.test.espresso.P         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 09:49

    For the same error on a text view I ended up doing as below, the answers posted above and other SO questions were a lot of help. I did try scrollTo method, but for some reason the error persisted. Hope this helps someone.

            onView(allOf(withId(R.id.recycler_view), isDisplayed())).perform(RecyclerViewActions
                    .actionOnItem(hasDescendant(withText("my text")), click()));
    

提交回复
热议问题