Forums - C# Corner

Forum guidelines


  • 1.4k
  • 100
  • 11.6k

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
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
HtmlDocument hd = webBrowser1.Document;
HtmlElement username = hd.GetElementById("userNameTextBoxId");// how to find id from                                                                                                                             //
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", "");
pass.SetAttribute("value", "mypassword");
Please help me. I am worried about it. 

Answers (1)