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
告诉
答案 0 :(得分:1)
看起来你只是表单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