InvokeMember(“click”) in WebBrowser control

前端 未结 1 1925
别跟我提以往
别跟我提以往 2020-12-20 10:10

A website shows a table based options to choose. HTML is



        
1条回答
  •  隐瞒了意图╮
    2020-12-20 11:14

    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");
                }
            }
        }
    

    0 讨论(0)
提交回复
热议问题