I. Using element.innerText/innerHTML/outerText/outerHTML
returns className
. Here's the code example:
public SHDocVw.InternetExplorer internetExplorer = new SHDocVw.InternetExp开发者_StackOverflow中文版lorer();
<...>
foreach (mshtml.HTMLSpanElement element in webBrowser.Document.GetElementsByTagName("SPAN"))
{
if (category.className == "classNameNeeded") //ClassName returns className
{
if (category.innerText == "InnerTextNeeded") //InnerText too
{
webBrowser.Navigate(category.parentElement.getAttribute("HREF"));
return true;
}
}
}
return false;
So my app works incorrectly
II. Using getElementById
returns DBNull
instead of element on a webpage. I'm completely sure that there's such an element on a webpage. Code example:
if(!webBrowser.Document.getElementById("IdNeeded").Equals(DBNull.value)){
<...>
}
I think that this problem is connected with HTML code of the page and it's parsing.
How can I solve these problems?
Thanks in advance.
精彩评论