Taking full page screenshot in selenium will discuss about how to take full page screenshot image in selenium webdriver while automating any application. As already we know how to take screenshot in selenium webdriver. But the actual issue is, when we take screenshot how much area will it capture. Here we need to discuss 2 things that how the methods which are available with Selenium webdriver will behave in Selenium 2 and Selenium 3 as recently selenium 3 is launched.

As already we know that in selenium 2; no extra drivers needed to launch the FirefoxDriver but for other browsers we need to use driver exe files to launch and work with. While working with the FirefoxDriver and try to take the screenshot then it will capture the entire page including the invisible area of the web page. But if you use other browsers then it will capture only the visible area of the webpage.

But coming to the Selenium 3, to launch any browser we need to use the driver exe files. So, while capturing the screenshot in selenium 3 it will capture only the visible area of the web page in all the browsers including firefox. To overcome this we can use third party utility called AShot. It is a WebDriver screenshot utility and by using this we can capture the entire page screenshot and can capture the individual webelement screenshot also.

For this, we need to download the ashot.jar file and add to the project along with the selenium jar files. We can download the ashot.jar file from here.

Below is the sample code to capture the entire page screenshot for any browser: