Muhammad Nadeem

Muhammad Nadeem

  • NA
  • 548
  • 63.3k

Login to gmail account through win form c# application

Aug 28 2017 12:09 PM
Hi everyone, I want to make a win form application in it I have webBrowser1 control. I want to login to gmail account through my win form c# app. When I goes through this code I hope my code is well but who to getElementById of username and password from gmail.com
 
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
 
HtmlDocument hd = webBrowser1.Document;
HtmlElement username = hd.GetElementById("userNameTextBoxId");// how to find id from                                                                                                                             //gmail.com
HtmlElement pass = hd.GetElementById("passwordTextBoxId");         // I goes through inspect 
HtmlElement submit = hd.GetElementById("BtnId");      // elements but m unable to find id's
username.SetAttribute("value", "[email protected]");
pass.SetAttribute("value", "mypassword");
submit.InvokeMember("click");
 
 }
Please help me. I am worried about it. 

Answers (1)