Trying to login to an Intranet site using WinForms and C#.
Following is the code for login -
webbrowserObject.Document.GetElementById("USER").SetAttribute("value", Properties.Settings.Default.UserEmail);
webbrowserObject.Document.GetType("password").SetAttribute("Value", Properties.Settings.Default.UserPassword);
webbrowserObject.Document.GetElementById("loginbtn").InvokeMember("submit");
Getting following error -
Severity Code Description Project Path File Line Suppression State
Error CS1501 No overload for method 'GetType' takes 1 arguments
And when I am changing the code as below -
webbrowserObject.Document.GetElementById("USER").SetAttribute("value", Properties.Settings.Default.UserEmail);
webbrowserObject.Document.GetElementById("PASSWORD").SetAttribute("Value", Properties.Settings.Default.UserPassword);
webbrowserObject.Document.GetElementById("loginbtn").InvokeMember("submit");
while (!DocumentLoaded)
Following is the error -
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=<Cannot evaluate the exception source>
StackTrace:
<Cannot evaluate the exception stack trace>
Following are the html information of the Site that I am trying to login to -
<input name="USER" class="form-control textbox center-block noborder " id="USER" autofocus="" required="" type="text" placeholder="User ID">
<input name="PASSWORD" class="form-control textbox center-block noborder" required="" onkeydown="return FormKeyPressed();" type="password" placeholder="Password">
User contributions licensed under CC BY-SA 3.0