这是我用来查找的内容,然后单击列表视图中的项目:
//Find and click a ListView item
public void clickListViewItem(String name) throws UiObjectNotFoundException {
UiScrollable listView = new UiScrollable(new UiSelector());
listView.setMaxSearchSwipes(100);
listView.scrollTextIntoView(name);
listView.waitForExists(5000);
UiObject listViewItem = listView.getChildByText(new UiSelector()
.className(android.widget.TextView.class.getName()), ""+name+"");
listViewItem.click();
System.out.println("\""+name+"\" ListView item was clicked.");
}
所以在你的情况下
clickListViewItem("Full Benchmark")
或者:
UiScrollable listView = new UiScrollable(new UiSelector());
listView.setMaxSearchSwipes(100);
listView.scrollTextIntoView(name);
listView.waitForExists(5000);
UiObject listViewItem = listView.getChildByText(new UiSelector()
.className(android.widget.TextView.class.getName()), "Full Benchmark");
listViewItem.click();