How to take a screenshot with HTML-Unit?

aGuest picture aGuest · Jun 20, 2011 · Viewed 8.6k times · Source

I'm from Germany so excuse me for some bad sentences.

I've coded an web-based application, now I want to do a screenshot of the page in one part of the code.

I'm using HTML-Unit, so I want to know how I can do it with it, it would be bad if I needed to change this in the whole project.

Looking forward for an answer, sincerely, a guest

Answer

Rodney Gitzel picture Rodney Gitzel · Jun 21, 2011

HtmlUnit never renders a page visually, so there's no image to capture.

There are tools like FireShot that do a good job of capturing web page images; perhaps there is one that can be accessed via an API, or perhaps you could script something up to interact with a browser.

Also see the accepted answer to How can I take fullscreen screenshot of website