Friday, July 3, 2009

How to get Control ID's from websites using C# web browser

ButtonGetID_Click
---------------
MessageBox.Show(webBrowser1.Document.ActiveElement.Id.ToString());
----------------


Insert data to the Fileds
--------------------------

webBrowser1.Document.ActiveElement.InnerText = "smilu";
webBrowser1.Document.GetElementById("Passwd").InnerText = "password";

--------------------------

Click in HTML Buttons
-----------------------------
HtmlElement el = webBrowser1.Document.All["signIn"];
object obj = el.DomElement;
System.Reflection.MethodInfo mi = obj.GetType().GetMethod("click");
mi.Invoke(obj, new object[0]);
------------------------------

No comments: