robsnider
6/16/2017 - 3:36 PM

From http://www.cubemg.com/how-to-click-a-button-on-a-web-page-with-applescript/

to clickID(theId) --creates a function that we can use over and over again instead of writing this code over and over again

tell application "Safari" -- lets AppleScript know what program to controll

do JavaScript "document.getElementById('" & theId & "').click();" in document 1 -- performs JavaScript code that clicks on the element of a specific id

end tell -- tells Applescript you are done talking to Safari

end clickID -- lets AppleScript know we are done with the function