I’ve been successful inputing forms in many different websites using the same commands. But when I try to enter the phone number forms on:
open location “https://www.telesign.com/phoneiddemo.asp”
Nothing happens.
Here’s my script:
tell application "Safari"
activate
open location "https://www.telesign.com/phoneiddemo.asp"
set areaCode to "512"
set phone1 to "555"
set phone2 to "1234"
delay 3
do JavaScript "document.forms[0].phone1.value = \"" & areaCode & "\"" in document 1
do JavaScript "document.forms[0].phone2.value = \"" & phone1 & "\"" in document 1
do JavaScript "document.forms[0].phone3.value = \"" & phone2 & "\"" in document 1
do JavaScript "document.forms[0].submit()" in document 1
end tell
I got the “name” for each text field from this html source code:
<input class='nice1' type='text' name='phone1' value='' size='3' maxlength='3' onkeyup='return autoTab(this,3,event);'><span class='text1'>-</span><input class='nice1' type='text' name='phone2' value='' size='3' maxlength='3' onkeyup='return autoTab(this,3,event);'><span class='text1'>-</span><input class='nice1' type='text' name='phone3' value='' size='4' maxlength='4' onkeyup='return autoTab(this,4,event);'>
But when I run the scipt, all it does is open the page. It doesn’t fill out any of the forms. Am I doing something wrong, or are there some websites that just won’t allow you do use Javascript to fill in forms?