SOF User
SOF User

Reputation: 7840

Problem in getting real HTML using C#....

I have one winform application. I can get HTML of page using webclient call or HtmlAgilityPack.dll

but issue is that HTML is getting without javascript execution ... let me explain..

let say one div is in HTML page which is hide by javascript using style=display:none; but when I get html using these techniques i can not get this div hidden... it shows me that div...

Upvotes: 3

Views: 193

Answers (1)

ForbesLindesay
ForbesLindesay

Reputation: 10712

The problem is that JavaScript is generally only executed when you render a page. In .net winforms there is a web browser control. If you add this to your form and navigate it to the web page it will execute javascript as you would normally expect. You can then google for samples of how to obtain the resulting DOM/HTML. If you want to avoid displaying the WebBrowser you may be able to just instantiate it in code behind instead and, failing that, try just giving it a height and width of 0.

Upvotes: 1

Related Questions