WebBrowser控件小知识

1.Document.Complete

 1             if (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
 2             {
 3                 return;
 4             }
 5 
 6             if(e.Url.ToString() != webBrowser1.Url.ToString())
 7             {
 8                 return;
 9             }
10 
11             //加载完成之后DoSomething

2.获取class标签

1             HtmlElementCollection collect = webBrowser1.Document.GetElementsByTagName("div");
2 
3             foreach (HtmlElement item in collect)
4             {
5                 if (item.GetAttribute("className") == "gtps fl")
6                 {
7                     MessageBox.Show(item.InnerHtml);
8                 }
9             }

 

posted @ 2014-03-30 20:58  Thirty  阅读(210)  评论(0编辑  收藏  举报