单击WebBrowser C#WinForm内的DIV元素

时间:2018-10-11 16:59:55

标签: c# winforms

我正在尝试模拟Web浏览器C#winforms中的div元素单击,但没有用

#region getting the voting button     
//cYUyoUM3wmgRXEHv1LlZv

HtmlElementCollection buttonCollection = VotingBrowser.Document.GetElementsByTagName("button");
foreach(HtmlElement btn in buttonCollection)
{
    //cYUyoUM3wmgRXEHv1LlZv
    string btnClassName = btn.GetAttribute("className");
    if(btnClassName == "cYUyoUM3wmgRXEHv1LlZv") {

        MessageBox.Show(btn.InnerHtml);

        btn.InvokeMember("click");

        return;
    }
}

0 个答案:

没有答案