Hello guys… knowing this structure…
I wrote this selector to click the button based on the text:
public WebElement getItemWithText(String name) {
return this.driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().text(\"" + name + "\")"));
}
public void clickButton(String name) {
getItemWithText(name)
.findElement(AppiumBy.androidUIAutomator("new UiSelector().fromParent(new UiSelector().className(\"android.view.View\"))"))
.findElement(AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.Button\"))"))
.click();
}
I take the element with the text then, i take the parent and inside that parent, i take the button. Then i click it.
But it seems to be a wrong selector… what did i miss?
