Form not submitting with JavaScript / AppleScript

I’ve got a script that acts as an alarm clock - it’s called from iCal, plays an iTunes playlist until I get out of bed and click a dialog box button, then checks my eMail and opens my “morning routine” websites.

I’m running into a problem with one particular webpage, and that’s my Scottrade account. Unlike some bank forms, the Scottrade login form allows the keychain to remember a user’s login information… so I know that much is correct. Plus if the login information is incorrect, it displays a message saying “Login Failed”. When the script executes, the page refreshes as if the form has been submitted, but it always ends up just refreshing and not actually submitting the form. No error or anything given by the page.

You can see the form here. There’s no JavaScript on the submit button or form tag. The form’s action is set to the same page (default.aspx), but after loading it immediately goes to LoginProcess.aspx, then to the home/default.aspx page that the information I seek every morning is on.

I realize this is silly at best and I should probably just bite the bullet and get used to one more click in the mornings, but ridding myself of clicks is what this script is all about. :slight_smile:

My only idea of a possibility is that Default.aspx checks for the .x or .y values (it’s an image input) passed from the button before sending the variables to LoginProcess.aspx. And perhaps submitting the form with JavaScript doesn’t send those variables, causing the script to fail.

I thought maybe someone here would know another reason this might be happening…

Model: Dual 1GHz QuickSilver G4
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)

Seems that Safari doesn’t recognize properly that form. When you ask for the number of “elements”, it returns 4 (instead of 5: hidden, login, pwd, select, submit-image).
Anyway, this should do the hack:

set x to "

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