1

I would like to capture a screenshot of a website including content that you can only see if you scrolled down.

Is that possible?

EDIT: I already tried https://github.com/ui4j/ui4j/blob/master/ui4j-sample/src/main/java/com/ui4j/sample/ScreenCapture.java, but it did not capture the whole page, just the visible portion(inside my monitor's viewport).

page.show(true);
page.captureScreen(new FileOutputStream(file));
int lawl is over 9000
  • 977
  • 1
  • 15
  • 25

1 Answers1

0

Yes, you could capture screenshot of the whole page with ui4j. Sample code:

package com.ui4j.sample;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import com.ui4j.api.browser.BrowserFactory;
import com.ui4j.api.browser.Page;

public class ScreenCapture {

    public static void main(String[] args) throws FileNotFoundException {
        Page page = BrowserFactory.getWebKit().navigate("https://www.google.com");
        page.show(true);
        page.captureScreen(new FileOutputStream(new File("google.png")));
    }
}

Alternative solution:

I highly recommend to use cdp4j library for full page screen capture. Its a Java library which help to automate Chrome/Chromium based browser. Here is the sample code.

  • Thats what I did, but it is just like a normal screenshot. What I'm looking for is a screenshot of the WHOLE page (+the portion which is outside the 1920x1080 px or whatever) – int lawl is over 9000 Aug 05 '15 at 10:49