InvokeMember(“click”) in WebBrowser control

允我心安 提交于 2019-11-29 12:54:29

You have multi radio button input you must loop through them,try this:

 private void Form1_Load_1(object sender, EventArgs e)
        {
            webBrowser1.Navigate("url");
        }


        private void webBrowser1_DocumentCompleted_1(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            foreach (HtmlElement el in webBrowser1.Document.GetElementsByTagName("input"))
            {
                if (el.Name == "gatewayIDV")
                {
                    el.InvokeMember("Click");
                }
            }
        }

Edited

For specific radio button

 private void Form1_Load_1(object sender, EventArgs e)
    {
        webBrowser1.Navigate(@"E:\Documents and Settings\Ali\Desktop\ww.html");
    }


    private void webBrowser1_DocumentCompleted_1(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
        foreach (HtmlElement el in webBrowser1.Document.GetElementsByTagName("input"))
        {
            if (el.Name == "gatewayIDV" && el.OuterHtml.Contains("setBank(11,0,1)"))
            {
                el.InvokeMember("Click");
            }
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!