在AppleScript中调用Javascript注销Facebook缺少的值

在AppleScript中调用Javascript注销Facebook缺少的值,javascript,facebook,applescript,getelementbyid,Javascript,Facebook,Applescript,Getelementbyid,我正在编写一个Applescript实用程序来登录Facebook,完成一些简单的任务,然后注销。除了注销,我的一切都正常。我想使用Safari,推荐的最可靠的方法是调用Javascript而不是使用系统事件。我对任何一种方式都持开放态度,只要我可以注销用户。注销操作是我尝试查找的一个菜单列表项,但是我使用此代码获得“缺少值”。非常感谢你的帮助 tell application "Safari" if not (exists document 1) then reopen tell docume

我正在编写一个Applescript实用程序来登录Facebook,完成一些简单的任务,然后注销。除了注销,我的一切都正常。我想使用Safari,推荐的最可靠的方法是调用Javascript而不是使用系统事件。我对任何一种方式都持开放态度,只要我可以注销用户。注销操作是我尝试查找的一个菜单列表项,但是我使用此代码获得“缺少值”。非常感谢你的帮助

tell application "Safari"
if not (exists document 1) then reopen
tell document 1
    set URL to "https://www.facebook.com"
    delay 3
    do JavaScript "document.getElementById('email').value='email-address';
document.getElementById('pass').value='password-value';
document.getElementById('loginbutton').click();
document.getElementById('persist_box').value='0';"
end tell

-- working code --
-- working code

-- Need to logout of this account

tell document 1
    set URL to "https://www.facebook.com/logout.php"
    delay 3
    do JavaScript "document.getElementById('logout_form').childNodes[0].click();"
end tell
end tell

-- from the Facebook page View Code
-- role="menuitem"><form id="logout_form" method="post" action="https://www.facebook.com/logout.php"    
onsubmit="return
告诉应用程序“Safari”
如果不存在(文档1),则重新打开
告诉文件1
将URL设置为“https://www.facebook.com"
延迟3
DoJavaScript“document.getElementById('email').value='email-address';
document.getElementById('pass').value='password-value';
document.getElementById('loginbutton')。单击();
document.getElementById('persist_box')。value='0';“
结束语
--工作代码--
--工作代码
--需要注销此帐户吗
告诉文件1
将URL设置为“https://www.facebook.com/logout.php"
延迟3
do JavaScript“document.getElementById('logout_form').childNodes[0]。单击()
结束语
结束语
--从Facebook页面查看代码

--role=“menuitem”>在其他地方找到了帮助。这成功了

tell application "Safari"
tell document 1
    do JavaScript "document.getElementById('logout_form').submit()"
end tell
end tell