这是我目前的代码。
tell application "Google Chrome" to set the URL of the front document to "Javascript:buy();"
它不允许我使用Javascript,我需要做些什么才能解决这个问题?
答案 0 :(得分:0)
您可以使用“执行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