Selenium developers have decided to discontinue the full-page screenshot feature: https://github.com/SeleniumHQ/selenium/issues/3912
What is the code necessary going forward, to emulate this feature in the application test scripts?
I tried to downgrade to Selenium 3.3.1, but there's some dependency on the driver and/or browser version which is not forward-compatible.
Solution found in an obscure open-source library:
pom.xml
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.5.4</version>
</dependency>
SomeJavaTest.java
private void screenshot(File out) throws IOException, InterruptedException, AWTException {
final Screenshot screenshot = new AShot()
.shootingStrategy(ShootingStrategies.viewportPasting(100))
.takeScreenshot(driver);
final BufferedImage image = screenshot.getImage();
ImageIO.write(image, "PNG", out);
}