制作的AppleScript填表 [英] Making AppleScript fill form

查看:225
本文介绍了制作的AppleScript填表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题是让我恶心。我工作过抛出的行动,以填补形式的AppleScript。我想我有一个问题,而得到它要等到该网站是在100%负载。该脚本激活网站,但不填的表格。请浏览我,帮助制定这个懒惰的脚本:

the problem I'm having is making me sick. I'm working over an applescript that throws action to fill form. I think I'm having an issue while getting it to wait until the site is loaded in 100%. The script activates the site but doesn't fill the forms. Please navigate me and help to work out this lazy script:

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 /层次问题。这为我工作:

Looks like you simply have the form id/hierarchy wrong. This worked for me:

tell application "Safari"
  do JavaScript "document.forms['registerform']['regusername'].value = '" & mylogin & "'" in document 1
end tell

...并使用相同的格式ID为密码字段等领域。

... and use the same form id for the 'password' field and other fields.

或者你可以做到这一点,也只有担心特定元素ID:<​​/ P>

or you can do this, too, and only worry about the specific element id:

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

这篇关于制作的AppleScript填表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆