A1VBCode Forums
Home
»
.NET Programming
»
Visual Basic .NET
Log on to webpage
http://www.a1vbcode.com/vbforums/Topic32030.aspx
By tonyallan8128
-
7/5/2013
Ok . I am trying to write some code to logon to a webpage. I have a form with webbrowser1 navigated to the login page.
the script for the input of UserId, Password and Submit inputs is as follows.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User ID
Password
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This is the code that i have tried.
'Inputs ID
WebBrowser1.Document.GetElementById("UserID").SetAttribute("Value", UserID) 'XXXXX this causes a nullreferance exception
'Inputs Password
WebBrowser1.Document.GetElementById("Password").SetAttribute("Value", Password)
'Submits information
WebBrowser1.Document.GetElementById("LogonForm").InvokeMember("submit")
Any suggestions would be appreciated.