DotNetBrowser DOM API provides functionality that allows you to simulate click on any HTML element on the loaded web page. To simulate click you need to make sure that web page is loaded completely and find the required HTML element in the document:


DOMDocument document = browser.GetDocument();
DOMElement link = document.GetElementById("submit_button");


Once you get the reference to the required HTML element, you can simulate click using the DOMNode.Click()method.


link.Click();


Please note that this method works asynchronously. When this method returns, it doesn't mean that click simulation is finished.

This functionality can be useful in automated testing when you need to simulate user actions including mouse clicks on specified HTML elements. For example:


browserView.Browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e)
{
  if (e.IsMainFrame)
  {
    Browser myBrowser = e.Browser;
    DOMDocument document = myBrowser.GetDocument();
    DOMElement link = document.GetElementById("button");
    if (link != null)
    {
      link.Click();
    }
  }
};
browserView.Browser.LoadHTML("<html><body><button id='button' " +
    "onclick=\"alert('Button has been clicked!');\">Click Me!</button>" +
    "</body></html>");