How can I progmatically click a link in a Winform Web Browser control?

落爺英雄遲暮 提交于 2019-12-23 03:51:46

问题


I would like to know how to programatically click a link from with in a Winform Web Browser control.

 foreach (HtmlElement linkElement in webBrowser.Document.GetElementsByTagName("A"))
            {
                if(linkElement.InnerText == "Helpful Tips")
                {
                  //Click Functionality
                }

回答1:


You should be able to do this using the InvokeMember method. Something along these lines:

linkElement.InvokeMember("Click")


来源:https://stackoverflow.com/questions/3419306/how-can-i-progmatically-click-a-link-in-a-winform-web-browser-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!