小编kev*_*.ho的帖子

Espresso onData在视图上执行"加载适配器数据"时出错

我有一个应用程序,有ListView,我想找到LinearLayout,id = order_untake_jijia_listview_jia

在此输入图像描述

代码是:

onData(withClassName(endsWith("ListView")))
            .inAdapterView(allOf(withId(R.id.order_untake_jijia_listview_ll), hasSibling(withText("9.0"))))
            .atPosition(0).onChildView(withId(R.id.order_untake_jijia_listview_jia));
            dataInteraction.perform(ViewActions.click());
Run Code Online (Sandbox Code Playgroud)

但我有错误:

Error performing 'load adapter data' on view '(with id: com.edaixi:id/order_untake_jijia_listview_ll and has sibling: with text: is "9.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:
(is assignable from class: class android.widget.AdapterView and is displayed on the screen to the user)
Target view: "LinearLayout{id=2131493753, res-name=order_untake_jijia_listview_ll, visibility=VISIBLE, width=170, height=50, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, …
Run Code Online (Sandbox Code Playgroud)

java testing android android-espresso

4
推荐指数
1
解决办法
6043
查看次数

标签 统计

android ×1

android-espresso ×1

java ×1

testing ×1