search text

I wonder is there a way to find text on the screen and click without using its id or xpath? I just want to use text. for example I want to find button which has a text “Click me”. Can I use click me as a search and click on it?

It is not recommended but you can use the xpath //*[text()=‘Click me’].

Dan said:

It is not recommended but you can use the xpath //*[text()=‘Click me’].

Actually I saw that function but it was on web testing. Can I use it on mobile?

And can you please explain me why not recommended ? because of complication?

Please excuse my bad, I did not look at the topic location and thought you were referring to Web Testing. I have no idea if it works for mobile testing as well, you could try but it might not work.