In this post, we will learn how to capture full length screenshot in 2 easy step.

We will be using shutterbug jar to capture it.

lets start.

Step 1- first of all add below shutterbug dependency in pom.xml file .






 Step 2-

Please refer below piece of code, where ever you want to take screen-capture,  use it and full-length capture will be saved.

This code, will capture page screenshot.

package mypackage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import com.assertthat.selenium_shutterbug.core.Shutterbug;
import com.assertthat.selenium_shutterbug.utils.web.ScrollStrategy;
public class Fullpagescreencapture {
public static void main(String[] args) {
// TODO Auto-generated method stub
String exePath = "./Resources/chromedriver.exe";
System.setProperty("", exePath);
WebDriver driver = new ChromeDriver();
//name of screenshot along with location, in below line it is saving screenshot inside Screenshot folder which is inside project parent folder(/Screenshot)

Where we should call this screenshot method-

1- If its a TestNG framework, call it inside listeners(ITestListner)

2- If it is a Cucumber framework, call it in Hooks.