C# webbrowser遍历网页元素

来源:互联网 发布:刘烨的演技 知乎 编辑:程序博客网 时间:2024/05/22 14:36
//不引用其他单元
 foreach(HtmlElement ele in WB1.Document.All)                {                  if(ele.InnerText=="下一页>")                  {                    bl_exist=true;                    ele.InvokeMember("Click");                    break;                  }                }
//引用mshtml;  IHTMLDocument2 doc = WB1.Document.DomDocument as IHTMLDocument2;                foreach (IHTMLElement ele in doc2.all)                {                    if (ele.innerText == "下一页>")                    {                        bl_exist = true;                        ele.click();                        break;                    }                }
0 0
原创粉丝点击