HtmlAgilityPack Get Rendered HTML

awesomium html html-agility-pack html-generation

Question

I am using HTMLAgilityPack and I want document in such a way as it appears on website. Mean if an html element has visibility: display:none, I dont want that node in my document.

I there any way to exclude such nodes having visible:none or hidden??

e.g.

<div class="changeodlabel" style="display:none;"><span class="default">Should not be in document html</span></div>
<div class="changeodlabel" ><span class="default">Should be in document html</span></div>

Popular Answer

Html Agility Pack has no notion of what CSS and Javascript mean, as such it just parses the HTML and let's you decide what to do with it. If you want the page to be fully evaluated before grabbing the contents you'll need a more advanced HTML parser. Awesonium comes to mind. Or you can wrap PhantomJS (check out the ChutzPah sources to see how that can be done).




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why