问题
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.
回答1:
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 :)
来源:https://stackoverflow.com/questions/14383039/applescript-javascript-execution-on-firefox