During the web scraping I want to save current page's html to a file for later debug. browser.html
helps in most cases, but when the page contains an iframe/frame, it's content is not returned in browser.html
, I have to get it separately with something like browser.iframe.html
There are also cases when inside an iframe is another iframe. I can find every frame recursively and save its content, but separated files won't be very useful because I don't know the exact structure of the page.
For example I have the following page:
<!DOCTYPE html>
<html>
<head>
</head>
<frameset cols="50%,20%,30%">
<frame name="left" src="/html/left_frame.htm" />
<frame name="right" src="/html/right_frame.htm" />
<noframes>
<body>
Your browser does not support frames.
</body>
</noframes>
<frame src="http://example.com"/>
</frameset>
</html>
I want to save it to file using watir. Any ideas?