zoukankan      html  css  js  c++  java
  • C#点击打开webbrowser中网页中的超链接

    1:使用webbrowser的 links方法

                //if (webBrowser1.Document != null)
                //{
                //    int j = webBrowser1.Document.Links.Count;
                //    for (int i = 0; i < j ; i++)
                //    {
                //        webBrowser1.Document.Links[i].InvokeMember("Click");
                //    }
                //}

    2: 使用了 HtmlDocument 的方法

          HtmlDocument doc = this.webBrowser1.Document;

                for (int i = 0; i < doc.All.Count; i++)
                {
                    if (doc.All[i].TagName == "A" || doc.All[i].TagName == "a")
                    {
                        HtmlElement elem = doc.All[i];
                        if (elem.OuterText == "自动收录网站")
                        {
                            elem.InvokeMember("Click");
                        }
                    }
                }

    还有一种方法自己测试了一半就没做了.因为时间很紧,写下来只要做以后的参考.          

  • 相关阅读:
    继承映射
    一对多,多对一,自关联的配置
    Spring 配置自动扫描spring bean配置
    Dao 处理
    2019暑假集训 括号匹配
    2019暑假集训 BLO
    2019暑假集训 Intervals
    2019暑假集训 平板涂色
    2019暑假集训 走廊泼水节
    0002-五层小山
  • 原文地址:https://www.cnblogs.com/yeye518/p/2231642.html
Copyright © 2011-2022 走看看