Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator Script - smart clicks on web pages

I've seen many variations and parts of this, but can't connect the dots. I need an automator script to:

1) Search for a defined (hard coded) text string in on a web page in Safari

2) Get the size & coordinates of the text string

3) Use the size & coordinates to determine the middle of the text string (horrizaontal & verticle)

4) Left mouse click on the middle point determined in the previous step


I think this would be very useful and could work (depending on how its done) for both buttons and text links on web pages even if they have java scripts to execute the links.

Automator-OTHER, Mac OS X (10.7.5)

Posted on Mar 9, 2013 11:00 PM

Reply
2 replies

Mar 11, 2013 12:04 AM in response to nevin009

This is way, way, way beyond Automator's top-line capability - that is there's nothing directly that Automator can do in this respect. The cloest you can get it an automator action that fires off some other process to do the work, in which case you might as well go straight to the source.


I suspect that you're way, way over-thinking the need, though - why do you care about finding the object's position in the page? or clicking it directly? It would be easier (although not necessarily 'easy') to query the DOM (or even the source) with a corresponding JavaScript action to 'click' the object. Unless there's something special about clicking in the middle (which, since you're talking about text, hardly seems likely), just following the link the text points to should be sufficient.


It's far, far easier to write a JavaScript to identify an object on the page and 'click' it, than it is to try and drill down through screen renderings.


There are numerous examples online of using AppleScript to click links on a page - remove your 'click in the center of the text based on its position on screen' requirement and you're almost there. 🙂

Automator Script - smart clicks on web pages

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.