WebBrowser control - Get element By type?

后端 未结 3 1100
长情又很酷
长情又很酷 2020-12-19 15:49

I need to get a element by type in C# the HTML looks like this:


         


        
3条回答
  •  旧时难觅i
    2020-12-19 16:22

    i have tried the following code, and was successfull.

    HtmlElementCollection htmlcol = ((WebBrowser)sender).Document.GetElementsByTagName("input");
    for (int i = 0; i < htmlcol.Count; i++)
                {
                    if (htmlcol[i].GetAttribute("value") == "Search")
                    {
                        htmlcol[i].InvokeMember("click");
                    }
                }
    

    i have tried this code for the following condition

    
    

    you can also try for such html tags and i am hopeful that it will work for you... enjoy

提交回复
热议问题