Save entire web page with all assets in Selenium WebDriver

Viewed 3398

I am looking a way to save the current DOM state of the webpage into a separate .html/.mht file with all images, JavaScript and CSS files included.

I know driver. PageSource / driver.getPageSource() allows to get the current DOM state, but how can I save all statically/dynamically referenced images, JavaScript files, CSS files and other assets?

Example, why I need this:

For instance, the web application is a Single Page Application, based on KnockoutJS framework.
When an error occurs during the test execution, I would like to have the HTML page which has all dynamically generated content in order to investigate the problem.

When I perform a static HTTP download -- it always gives me the project login page, instead of the current opened documents.

1 Answers
Related