How to click a button on an ASP.NET web page programmatically?

前端 未结 9 1377
既然无缘
既然无缘 2021-02-09 10:06

I am trying to figure out how to click a button on a web page programmatically.

Specifically, I have a WinForm with a WebBrowser control. Once it navigates to the targe

9条回答
  •  醉梦人生
    2021-02-09 10:56

    You can try and invoke the Page_ClientValidate() method directly through the clientscript instead of clicking the button, let me dig up an example.

    Using MSHTML

    mshtml.IHTMLWindow2 myBroserWindow = (mshtml.IHTMLWindow2)MyWebBrowser.Document.Window.DomWindow;
    myBroserWindow.execScript("Page_ClientValidate();", "javascript");
    

提交回复
热议问题