[英]android & testing with Robotium, how select a element of the listView in fragment?
In testing with Robotium, how select a element of the listView in fragment ? 在使用Robotium进行测试时,如何在片段中选择listView的元素? I have 2 fragment Container in layout : 我在布局中有2个片段容器:
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
> ...
> <FrameLayout
> xmlns:android="http://schemas.android.com/apk/res/android"
> android:id="@+id/fragment_container_left"
> ... />
> <FrameLayout
> xmlns:android="http://schemas.android.com/apk/res/android"
> android:id="@+id/fragment_container_rigth"
> .../>
> />
and each fragment are load with the following code : 并使用以下代码加载每个片段:
> <ListView
> android:id="@+id/listView1"
> ... />
and my testing is the following : 我的测试如下:
@Override
protected void setUp() throws Exception {
super.setUp();
mActivity = getActivity();
mIns = this.getInstrumentation();
solo = new Solo(mIns, mActivity);
}
public void testBackButton() {
// click in listView
solo.clickInList(0);
solo.clickInList(0);
... }
the problem is that solo.clickInList(0), always being done click the ListView element belonging to the fragment on the right laden. 问题是solo.clickInList(0),总是被点击属于右边负载片段的ListView元素。 how do to "solo.clickInList()" click the list on the left here image ?? 怎么做“solo.clickInList()”点击左边的列表这里的图像 ?
There's a solo.clickInList(0, integer);
有一个solo.clickInList(0, integer);
that lets you specify which list to click. 它允许您指定要单击的列表。 Did you try that? 你试过吗? You can also click on a specific text. 您还可以单击特定文本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.