如何在webbrowser控件c#中处理弹出窗口

时间:2015-06-26 17:20:59

标签: c# popup controls webbrowser-control

我使用webbrowser控件导航到一个按钮的按钮,当按下按钮时会出现弹出窗口,我必须在弹出窗口中执行某些操作,然后我必须关闭它并返回浏览器。 我尝试用NewWindow事件来做这个,但是我无法使它工作

foreach (System.Windows.Forms.HtmlElement html in webBrowser.Document.GetElementsByTagName("a"))
{
    if (html.InnerText == "Like")
    {        
        html.InvokeMember("click"); // here i press the button and the pop-up appear
       // Here I must make some actions in the pop-up(I must press other button)
       // and here I must close the popup and to continue in the first page
    }
}

0 个答案:

没有答案