Search code examples
python-3.xautomationappium

How to find element in appium using text?


I want to click on a button on a website. Is there a code which can allow me to click on the element by using the TEXT field? I can neither use the resource id field nor name as they are empty. I tried to click on the element using the xpath but that did not work.


Solution

  • this is example using Java, but i believe that it is pretty easy to migrate it to a Python. You need to use AndroidUiAutomator:

    androidDriver.findElementByAndroidUIAutomator("new UiSelector().text(\"your_text\")").click();