3

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...

2
  • 1
    See stackoverflow.com/q/125177/485076 Commented Aug 14, 2011 at 0:15
  • 1
    I can't figure out what you are doing. Would you describe more on your windows form application? Commented Aug 14, 2011 at 0:21

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried did already... but if we put web browser control then it its own issue .. its completed event occur many time ... and then I google so i found its readystate property should be complete but i found it still fire this event with readystate property complete many time
It's not an ideal solution, but you could use something like reactive extensions with Throttle, to reduce the number of times it's fired. That way you only handle the last event in each time you navigate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.