我遇到的问题是让我生病.我正在研究一个可以填补表格的AppleScript.我认为我在让它等到网站100%加载时遇到问题.该脚本激活网站但不填写表单.请导航我并帮助解决这个懒惰的脚本:
tell application "Safari" set loginurl to "http://www.dogomania.pl/forum/register.php" set mylogin to "worker100" set mypassword to "blackie698" tell application "Safari" make new document at end of documents set URL of document 1 to loginurl delay 4 do JavaScript "document.forms['regusername']['username'].value = '" & mylogin & "'" in document 1 do JavaScript "document.forms['password']['password'].value = '" & mypassword & "'" in document 1 end tell
结束告诉
解决方法
看起来你只是表单id / hierarchy错误.这对我有用:
tell application "Safari" do JavaScript "document.forms['registerform']['regusername'].value = '" & mylogin & "'" in document 1 end tell
…并为“密码”字段和其他字段使用相同的表单ID.
或者你也可以这样做,只担心具体的元素id:
tell application "Safari" do JavaScript "document.getElementById('regusername').value = '" & mylogin & "'" in document 1 end tell
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。