制作AppleScript填写表单

前端之家收集整理的这篇文章主要介绍了制作AppleScript填写表单前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我遇到的问题是让我生病.我正在研究一个可以填补表格的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
原文链接:https://www.f2er.com/html/232514.html

猜你在找的HTML相关文章