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

前端 未结 9 1560
梦谈多话
梦谈多话 2021-02-09 09:57

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:33

    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");
    

提交回复
热议问题