Tuesday, 6 August 2013

Android uiautomator - select multiple items at once

Android uiautomator - select multiple items at once

I am trying to automate the contact selection process using Android
uiautomator. My UI looks like below image. I am using below code to check
each contact
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());
}
}
This code is inefficient. It takes longtime to find each contact and
check. Is there away to loop each row and check ?
Thank you.
..

No comments:

Post a Comment