How to simulate a mouse click using a WebBrowser control

Using the WebBrowser , I can trigger an event when I click the mouse button manually, but I want the program to perform the click itself, and not to do something when I manually click.

For example, if I provide the identifier of a control on a page, I want the program to click on it.

Here is what I still have:

 HtmlElement button = webBrowser1.Document.GetElementById("lButtonSearch"); button.Click += new HtmlElementEventHandler(GotoSearchPage); 
+7
source share
1 answer

Pretty easy, just use:

 button.InvokeMember("click"); 
+14
source

All Articles