Search and click element by text


I started developing some tests for an iOS app, using Python as a programming language. I have some buttons (which for the moments doesn’t have ids) and I was wondering what is the best method to search for example, a button with a certain text and click it.

On Android I’m successfully using:

On iOS I tried using:

but I get the following error in PyCharm:
selenium.common.exceptions.InvalidSelectorException: Message: Locator Strategy ‘-ios uiautomation’ is not supported for this session

Any help, please?


uiAutiomation = Android. With ios you should use predicate.

@Aleksei I have a scenario in android application, where I am trying to click a button with the help of resource-id, xpath, text, tag but nothing works. I tried with AndroidTouchActions but still no help.

The element shows it performed the click operation in the console but in the device there is no action it remains in the same page.

What else we can try to perform the click


  1. enable in developer mode on Android phone to show touches and coordinates
  2. check where actually tap happens
  3. try tap using element coordinates (center of element)
  4. try also switching to w3c actions