For more complex tasks like form filling, scripts often combine AppleScript with JavaScript: Working in a Safari Browser - AppleScript | Mac OS X
Note : For security, you must enable in Safari's "Develop" menu. Automating Web Content applescript safari s
Safari's native scripting dictionary is relatively small, with most interaction occurring via the do JavaScript command. For more complex tasks like form filling, scripts