I am trying to search for a LinearLayout in a ScrollView. So say that this LinearLayout contains two child TextView: “Celtics” and “Mavericks”. How should I search for this view? I’ve tried the following:
String CRITERIA = "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().childSelector(new UiSelector().textContains(\"Celtics\")))"
driver.findElementByAndroidUIAutomator(CRITERIA);
This can find Celtics
just fine but if there are multiple Celtics
then I run into trouble. I tried this criteria but it doesn’t work.
String CRITERIA = "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().childSelector(new UiSelector().textContains(\"Celtics\")).fromParent(new UiSelector().textContains(\"Mavericks\")))"
Is there a way to find a parent element that contains specified child elements?