AS Web page login problems with Safari! Heeealp! ;0)

Hi all.

Fairly new to this & as a result spent a while reading relevant posts (particularly from JJ) but not having done much dev. work I’m at a loss! It just won’t populate the uname & password fields even with a delay to allow the page to fully load first! I got the form references by looking at the source of the page. Could anyone help please?

[b]property target_url : “https://projectplace.com/pp/pp.cgi/0/43507983

tell application “Safari” to open location target_url

delay 25

set x to “document.forms[’ mainform’].elements[‘uname’].value=‘xxxxx’;document.forms[‘mainform’].elements[‘password’].value=‘xxxxx’;”

tell application “Safari” to do JavaScript x in document 1[/b]

Thanks in advance

R…

There you go:


property target_url : "https://projectplace.com/pp/pp.cgi/0/43507983"

tell application "Safari" to open location target_url

delay 25

tell application "Safari" to do JavaScript "document.mainform.uname.value = \"xxx\"; document.forms.mainform.password.value=\"xxxxx\";" in document 1

Safari didn’t like your JavaScript… I noticed that the fields you are populating are actually hidden and are not the fields you can see…

Hope that makes sense,

Tom

There is some tricky javascript in this form, so regular methods won’t work. Use this instead:

set x to "document.getElementsByTagName('input').item('4').value = 'foo';
document.getElementsByTagName('input').item('5').value = 'bar';
document.getElementsByTagName('input').item('6').click();
// if the click() method doesn't work for you (it does in Safari 2.0.1), use the following line instead:
// document.mainform.submit()"


tell application "Safari" to do JavaScript x in document 1

Thanks ever so much folks, will give it a go…

So close yet so far… :frowning:

It places the user name but doesn’t do anything with the password field. AS is showing “” in the event window.

I tried changing the item no. but no luck.

ANy other suggestions?

Thansk for your ongoing help

Works fine here… Perhaps you’re surfing different code because of cookies or similar… (?)

Hmmm will run some more tests tonite.

R…

Working!

Thanks again.

R…