开发者

Get HTML Source after JavaScript manipulations

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.开发者_JAVA百科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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜