Full page screenshot in Chrome with Selenium WebDriver

By Glib Briia on November 27, 2016

One line java solution for taking full page screenshot in Chrome using WebDriver and selenium-shutterbug

One can come across two definitions of ‘screenshot’ while using WebDriver.

First is that screenshot is an image of the entire DOM of the loaded page, which is exactly what Firefox and IE drivers are doing.

Second one is used in W3C WebDriver specification where a screenshot is defined as an image of the top-level browsing context’s viewport.

ChromeDriver is following the latter definition and there is an open issue raised in this regard: chromium - 294

It really becomes a matter of dispute when discussing which one of the definitions above should be adhered to.

Nevertheless there is a necessity to get the full page screenshot while running tests. To accomplish this I would recommend to use the following line:

  Shutterbug.shootPage(driver, ScrollStrategy.BOTH_DIRECTIONS).save();

which will make the full page screenshot in Chrome and any other browser of your choice.

For installation and further usage info please refer to selenium-shutterbug