Suppose you have:
<parent> <child1> <child1.1></child1.1> <child1.2></child1.2> </child1> <child2> <child2.1></child2.1> <child2.2></child2.2> </child2> <child3> <child3.1></child3.1> <child3.2></child3.2> </child3> </parent>
Bellow solution will return the result Child 1, Child 2, Child 3
UiObject object = new UiObject(<UiSelector for Parent>); int cnt = object.getChildCount(); for(int i = 0; i < cnt; i++) { UiObject eachItem = object.getChild(new UiSelector().index(i)); }
If you need baby 1.1, baby 1.2 and baby 2.1
UiObject object = new UiObject(<UiSelector for Parent>); int cnt = object.getChildCount(); for(int i = 0; i < cnt; i++) { UiObject eachItem = object.getChild(new UiSelector().index(i)) .getChild(<UiSelector for child 1.1 or child 1.2 ...>);
source share