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
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