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 <input type="text" id="UserID" name="UserID" tabindex="1" onkeypress="checkEnter(event);" /><br />
Password <input type="password" id="Password" name="Password" tabindex="2" onkeypress="checkEnter(event);" /><br />
<a href="#" onclick='document.forms["LogonForm"].submit()'><img class="mainsp sprite-btn_login" src="https://cdn.webpagename.com/site/assets/images/spacer.gif" title="Login" /></a>
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.
the script for the input of UserId, Password and Submit inputs is as follows.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User ID <input type="text" id="UserID" name="UserID" tabindex="1" onkeypress="checkEnter(event);" /><br />
Password <input type="password" id="Password" name="Password" tabindex="2" onkeypress="checkEnter(event);" /><br />
<a href="#" onclick='document.forms["LogonForm"].submit()'><img class="mainsp sprite-btn_login" src="https://cdn.webpagename.com/site/assets/images/spacer.gif" title="Login" /></a>
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.