Clicking button on second activity got error performing 'single click' or 'scroll to' on view

后端 未结 2 577
夕颜
夕颜 2020-12-17 07:40

Clicking a button in Espresso test got problem. Let\'s say I have two activities \"Activity1\" and \"Activity2\". Click a dialog OK button in Activity1 starts Activity2 wher

2条回答
  •  温柔的废话
    2020-12-17 08:19

    Seems your view with id R.id.btnMP is not visible at the screen so you are receiving the first error. You are trying to resolve this by scrollTo() but your view in not inside ScrollView. So how your activity is organized? If you are using RecyclerView (for example) you should use special version of scrollTo - http://developer.android.com/reference/android/support/test/espresso/contrib/RecyclerViewActions.html and so on. So first take a look where your view is hosted and then it will be clear how to scroll to it.

提交回复
热议问题