i am actually trying to grap the text from a tag which has some child tags
For example:
<p><span>Child Text </span><span class="price">Child Text</span><br />
I need this text</p>
This is what i am trying
HtmlElement menuElement = browser.Document.GetElementsByTagName("p");
String mytext = menuElement.InnerHtml; //also tried innerText,OuterHtml,OuterText
UPDATE: I think i have to use Htmlagilitypack, so now my question is how to do this using htmlagilitypack lib, I’m new to it.
Thanks
There are many approaches to this from using regex to web scraping libraries.i recommend you to use htmlagilitypack with that you can address exactly what you need by xpath.
add reference and namespace to HtmlAgilityPack and i ‘m using linq(this requires .net 3.5 or better) with the code below you can do that.
// these references must be available.