Find and Click a Button With OCR

Is there a way to use OCR to find and click on a button (with text) on a Safari screen?

I want to do this because the website I visit changes design and layout a lot. Even the Xpath changes.

Hey Brian,

Give Click at Found Image a try.


Thank you, however; I do not want to screen capture a button and paste it in my code each month - so Click at found image is exactly want I am looking not to do.

I was wondering if it is possible to use:

If all of the following are true:
The OCR of:
in main screen
contains "Contribute"
execute the following actions:
<<<code here that clicks the center of the found OCR word>>>>

Keyboard Maestro's OCR capability is limited to converting an image to text and will not create positional parameters.

There may or may not be consistent factors about the given web page that allow for coding the task either with JavaScript or UI-Scripting.

But I'd have to see the page and test...


I have dealt with this a lot, and can often be overcome by using relative JavaScript querySelector() commands. If you will post the page URL, or the actual HTML code (using the forum Code Block) we can take a look to see if it is possible.

Also include a screenshot indicating the button you want to click on.