Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automating Website Log In

0 views
Skip to first unread message

Jason C. Lamb

unread,
Nov 23, 2009, 5:31:27 PM11/23/09
to
I am trying to automate getting some data from a website that requires
the user to login to access their data. I have the following code
which opens the page and sets the username and password, but I am
having trouble submitting the form.

I am not sure that even setting the username/password values is
working correctly, because if I step through the code, and manually
enter a value in the username field, then have the code below update
that to the correct user name, then click in the edit box, the
previous manual data returns... Strange...

Any one have any ideas how to properly submit this form so I can
authenticate?

Thanks....
Jason

Dim objIE As New SHDocVw.InternetExplorer 'Microsoft Internet
Controls
Dim objDOM As HTMLDocument 'Micosoft HTML Object Library
Dim txtField As HTMLInputTextElement
Dim btnLogin As HTMLButtonElement

objIE.Visible = True

objIE.Navigate2 "http://agencyfuel.zywave.com"

Do While objIE.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop

Set objDOM = objIE.Document

Set txtField = objDOM.all
("dnn_ctr616_View_ctl01_UsernameTextBox_text")
txtField.Value = "MyUserName"

Set txtField = objDOM.all
("dnn_ctr616_View_ctl01_PasswordTextBox_text")
txtField.Value = "MySecretPassword"

Set btnLogin = objDOM.all("dnn_ctr616_View_ctl01_LoginButton")
btnLogin.click

'objDOM.forms(0).submit

0 new messages