0

これが私の現在のコードです。

    tell application "Google Chrome" to set the URL of the front document to "Javascript:buy();"

Javascript を使用することはできませんが、その問題を解決するにはどうすればよいですか?

4

1 に答える 1

0

「execute javascript」コマンドを使用して、Chrome で JavaScript を実行します。

tell application "Google Chrome"
    activate
    tell window 1 to tell active tab
        set URL to "http://stackoverflow.com/questions/13896927/applescript-script-to-make-current-url-change-to-a-javascript"
        repeat until not loading
            delay 0.2
        end repeat
        set myVar to execute javascript "document.getElementsByClassName('user-details')[0].childNodes[1].text"
    end tell
end tell

return myVar

.

tell application "Google Chrome"
    activate
    tell window 1 to tell active tab
        set the URL to "Javascript:buy();"
    end tell
end tell
于 2012-12-16T00:03:55.330 に答える