0

测试中有一个下拉列表。录音机点击打开选项下拉菜单。但是随后单击以选择一个失败并出现以下错误:

Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints:
at least 90 percent of the view's area is displayed to the user.

这个问题Android Espresso error on button click处理了约束,但它建议简单地使用 isCompletelyDisplayed() 不起作用。

4

1 回答 1

1

是的,当您单击的视图位于使其对用户不可见的滚动位置时,就会发生这种情况。

只需使用:

onView(withId(whatever)).perform(scrollTo(), click())

我假设您的视图可以使用 onview 选择器作为目标。

于 2017-03-12T21:29:41.157 回答