刚找到方法了 谢谢2楼- private HtmlElement GetHtmlElement(HtmlDocument htmlDoc)
- {
- HtmlElementCollection htmls = htmlDoc.GetElementsByTagName("a");
- for (int i = 0; i < htmls.Count; i++)
- {
- String str = htmls[i].GetAttribute("href");
- if (str == "http://www.xxx.com")
- {
- return htmls[i];
- }
- }
- return null;
- }
复制代码 |