Hi all, I need to automize login process of a widsite. After googling for a while, I wrote this code. But the problem is after running this code, no errors, no output. I am unable to know where I went wrong.
private void Form1_Load(object sender, EventArgs e)
{
WebBrowser browser = new WebBrowser();
string target = "http://authcisco/auth.html";
browser.Navigate(target);
browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(Credentials);
}
private void Credentials(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser b = (WebBrowser)sender;
b.Document.GetElementById("userName").SetAttribute("value", "shyam");
b.Document.GetElementById("pass").SetAttribute("value", "shyam");
b.Document.GetElementById("Submit").InvokeMember("click");
}
Thank You.