[英]How to simulate mouse click with the WebBrowser control
Using the WebBrowser
control I am able to call an event when the mouse button is manually clicked, but I want the program to do the click itself, not do something when I manually perform the click. 使用WebBrowser
控件我可以在手动单击鼠标按钮时调用事件,但我希望程序自己执行单击操作,而不是在手动执行单击时执行某些操作。
For example, if I provide the ID of a control on the page I want the program to click it. 例如,如果我在页面上提供控件的ID,我希望程序单击它。
Here's what I have so far: 这是我到目前为止所拥有的:
HtmlElement button = webBrowser1.Document.GetElementById("lButtonSearch");
button.Click += new HtmlElementEventHandler(GotoSearchPage);
很简单,只需使用:
button.InvokeMember("click");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.