Safari and Chrome can execute JavaScript via AppleScript
Safari:
tell application "Safari"
open location "http://example.com"
activate
do JavaScript "alert('example');" in current tab of first window
end tell
Chrome:
tell application "Google Chrome"
open location "http://example.com"
activate
execute front window's active tab javascript "alert('example');"
end tell
Is there a way to do this in Firefox?
Note: Same question for Opera is here: AppleScript - JavaScript execution on Opera
I thought about asking them together, but I decided to ask two separate questions to be able to accept answers separately.
Running javascript using AppleScript in Firefox has not been implemented. Bug Story.
It is in New state and with no assignees. You could take that up :)