Javascript 如何使用Applescript通过Chrome自动登录网站?
我想使用谷歌浏览器自动登录到该网站 我知道如何在Safari中使用Applescript,但我不知道如何为Chrome编写脚本 这是我的Safari自动登录的Applescript。我怎么能用Chrome做同样的事情呢Javascript 如何使用Applescript通过Chrome自动登录网站?,javascript,google-chrome,applescript,Javascript,Google Chrome,Applescript,我想使用谷歌浏览器自动登录到该网站 我知道如何在Safari中使用Applescript,但我不知道如何为Chrome编写脚本 这是我的Safari自动登录的Applescript。我怎么能用Chrome做同样的事情呢 您执行javascript,对象被附加到窗口的选项卡上。因此: tell application "Google Chrome" activate tell window 1 tell active tab if (its
您执行javascript,对象被附加到窗口的选项卡上。因此:
tell application "Google Chrome"
activate
tell window 1
tell active tab
if (its URL) starts with "https://account.nicovideo.jp/login" or (its URL) starts with "https://secure.nicoga.jp/" then
execute javascript "document.forms[0].mail_tel.value='example@email.com'"
execute javascript "document.forms[0].password.value='password in here'"
execute javascript "document.forms[0].submit()"
end if
end tell
end tell
end tell
tell application "Google Chrome"
activate
tell window 1
tell active tab
if (its URL) starts with "https://account.nicovideo.jp/login" or (its URL) starts with "https://secure.nicoga.jp/" then
execute javascript "document.forms[0].mail_tel.value='example@email.com'"
execute javascript "document.forms[0].password.value='password in here'"
execute javascript "document.forms[0].submit()"
end if
end tell
end tell
end tell