0
的HTML代碼可以當我通過C#的WebBrowser applition,如何單擊超鏈接內文本區域
foreach (HtmlElement item in ieBrowser.document.Links)
{
var innerText = item.InnerText;
if ((string.IsNullOrEmpty(innerText)) || innerText.Length == 0) continue;
if (innerText.Contains(task.ShopName))
{
item.ScrollIntoView(true);
item.Focus();
item.SetAttribute("selected", "true");
item.SetAttribute("target", "_self");
item.InvokeMember("Click");
break;
}
}
枚舉的樣子
<html>
<body>
......
<textarea>
<div>
<a href="http://www.sohu.com">This is a hyper link </a>
</div>
</textarea>
......
</body>
</html>
的鏈接,但,似乎web瀏覽器無法識別textArea內的鏈接。任何知道如何處理這個問題的人。
thaks.i知道它。但是我想是'的HtmlElement item.InvokeMember(「點擊」);''沒有的「href」'屬性。 –
不可能,textarea的內容不會被解析爲DOM – volody