I want to take Screenshot of the web-page at Runtime while screen-scraping with HtmlUnit or Jsoup in Java.
Is there any way to do so?
I want to take Screenshot of the web-page at Runtime while screen-scraping with HtmlUnit or Jsoup in Java.
Is there any way to do so?
HtmlUnit does not render the elements. It is GUI-less (headless) browser.
Please find sample code using WebDriver/Selenium here.
This item may be helpful. It uses java.awt.Robot
to take a screen shot and save it to disk.
Try this one Robot#createScreenCapture().
BufferedImage image = new Robot().createScreenCapture(newRectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(image, "png", new File("/screenshot.png"));