How to take a screenshot of the entire web page (full-page screenshot), not only partial (top-to-bottom) using Selenium WebDriver?
My code:
It is possible to start Chrome in headless mode and then set the window size to the same height of the page body.
Since the height of your headless browser is not dependent on your monitor size you can use this headless mode to get full length screenshots as they are rendered in the Chrome browser.
The top answer for Headless Chrome run with selenium seems to show the right way to start Chrome in headless mode with java. I work with python bindings but the answer looks pretty similar to what I do.
This is the relevant part. This code should go before you start an instance of ChromeDriver.
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
ChromeDriver driver = new ChromeDriver(chromeOptions);
If running chrome in a headless browser is not a viable option then you'll have to use Firefox or IE. Both of these browsers will give you a full length screenshot