Login To Facebook Account Using C#, Webbrowser And LINQ
Hi,
Here's how to login to your facebook account using Webbrowser control and LINQ in Windows Forms. The input elements are checked through their attributes like "email" for email fields, "password" for password fields and "submit" for submission control. These codes are inside the DocumentCompleted event.
C# code
VB.NET Code
Here's how to login to your facebook account using Webbrowser control and LINQ in Windows Forms. The input elements are checked through their attributes like "email" for email fields, "password" for password fields and "submit" for submission control. These codes are inside the DocumentCompleted event.
C# code
WebBrowser1.Document.GetElementsByTagName("input").Cast<HtmlElement>().FirstOrDefault(t => t.GetAttribute("type") == "email").SetAttribute("value", "your email address"); WebBrowser1.Document.GetElementsByTagName("input").Cast<HtmlElement>().FirstOrDefault(t => t.GetAttribute("type") == "password").SetAttribute("value", "your user name"); WebBrowser1.Document.GetElementsByTagName("input").Cast<HtmlElement>().FirstOrDefault(t => t.GetAttribute("type") == "submit").InvokeMember("click");
WebBrowser1.Document.GetElementsByTagName("input").Cast(Of HtmlElement)().FirstOrDefault(Function(t) t.GetAttribute("type") = "email").SetAttribute("value", "your email address") WebBrowser1.Document.GetElementsByTagName("input").Cast(Of HtmlElement)().FirstOrDefault(Function(t) t.GetAttribute("type") = "password").SetAttribute("value", "your user name") WebBrowser1.Document.GetElementsByTagName("input").Cast(Of HtmlElement)().FirstOrDefault(Function(t) t.GetAttribute("type") = "submit").InvokeMember("click")
Comments
Post a Comment