制作AppleScript填写表单

前端之家收集整理的这篇文章主要介绍了制作AppleScript填写表单前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_0@
我遇到的问题是让我生病.我正在研究一个可以填补表格的AppleScript.我认为我在让它等到网站100%加载时遇到问题.该脚本激活网站但不填写表单.请导航我并帮助解决这个懒惰的脚本:
  1. tell application "Safari"
  2. set loginurl to "http://www.dogomania.pl/forum/register.PHP"
  3. set mylogin to "worker100"
  4. set mypassword to "blackie698"
  5. tell application "Safari"
  6. make new document at end of documents
  7. set URL of document 1 to loginurl
  8. delay 4
  9. do JavaScript "document.forms['regusername']['username'].value = '" & mylogin & "'" in document 1
  10. do JavaScript "document.forms['password']['password'].value = '" & mypassword & "'" in document 1
  11. end tell

结束告诉

解决方法

看起来你只是表单id / hierarchy错误.这对我有用:
  1. tell application "Safari"
  2. do JavaScript "document.forms['registerform']['regusername'].value = '" & mylogin & "'" in document 1
  3. end tell

…并为“密码”字段和其他字段使用相同的表单ID.

或者你也可以这样做,只担心具体的元素id:

  1. tell application "Safari"
  2. do JavaScript "document.getElementById('regusername').value = '" & mylogin & "'" in document 1
  3. end tell

猜你在找的HTML相关文章