Click on safari web page button using AppleScript
I'm trying to figure out how to click on the button in a webpage. For example click on the "I'm Feeling Lucky" button in google web page. This is what I have tried: tell application "Safari" make new document with properties {URL:"https://www.google.com/"} do JavaScript "eval(document.getElementById('I'm Feeling Lucky').parentNode.href.substring(11))" in document 1 delay 1 end tell But it doesn't work. Any of you knows how can I click on the button using applescript? I'll really appreciate your help jweaks Couple things: Best practice in the safari tell block is to also tell document 1. Also,