How do i get the full! HTML source of a web page, after it has run some JavaScript code which has made manipulations to the HTML source.
I'm using the WebbrowserControl of VB.Net, i'd like to create an extra function of my custom webbrowsercontrol which receives the full HTML source.
Thanks in advance
The trick is going to be finding a way to notify the control about whether the JS is done running. You might be able to do that by having the JS set a form element' value (isJSComplete) when it has completed and polling with the web browser control.
Use the following code to check a form value to see if it is ready
MyBrowserControl.document.getElementById('isJSComplete');
Use the following code to pull the HTML from the page.
MyBrowserControl.Document.documentElement.OuterHTML
Better yet, here is an article showing how to wire up JS events to be handled by the WebBrowser control. You could just fire an event when the JS is done and have your code trap that event and then pull the HTML using the above approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With