After WebBrowser document loads, Its document contains something like:
<div id="toextract">
<div>This</div>
<div>is</div>
Sample
<div>text</div>
I
<div>want to</div>
<div>Extract</div>
</div>
I want to extract InnerHtml of these elements so that the output would be:
This is Sample text I want to Extract
but i get this:
This is text want to Extract
as the word I and Sample are not in an HtmlElement. this is my code:
string Ex = "";
HtmlElement elem = webBrowser1.Document.GetElementById("toextract");
HtmlElementCollection elems = elem.All
for(int i=0;i<elems.Count;i++)
Ex += elems[i].InnerHtml + " ";
my code skips text-nodes (nodes with no tag). I think its because they are not considered as HtmlElement. How can include them in my extracted text?