我正在尝试使用Android uiautomator自动执行联系人选择过程。我的用户界面如下图所示。我使用下面的代码来检查每个联系人Android uiautomator - 一次选择多个项目
for (String contactName : list) {
UiScrollable scrollable = new UiScrollable(new UiSelector().className(
android.widget.ListView.class).scrollable(true))
.setAsVerticalList();
try {
UiObject obj = scrollable.getChildByText(LIST_VIEW_ITEM, contactName, true);
obj.click();
} catch (Exception e) { }
finally {
scrollable.scrollToBeginning(scrollable.getMaxSearchSwipes());
}
}
此代码效率低下。需要很长时间才能找到每个联系人并进行检查。有没有去循环每一行并检查?
谢谢。
。