Safari和Chrome可以通过AppleScript执行JavaScript
Safari浏览器:
tell application "Safari"
open location "http://example.com"
activate
do JavaScript "alert('example');" in current tab of first window
end tell
铬:
tell application "Google Chrome"
open location "http://example.com"
activate
execute front window's active tab javascript "alert('example');"
end tell
有没有办法在Firefox中执行此操作?
注意:Opera的相同问题在于:AppleScript - JavaScript execution on Opera
我想过一起问他们,但我决定分别提出两个问题来分别接受答案。