Selenium Webdriver Appium Complete TutorialSelenium Webdriver Appium Complete Tutorial
Automation Testing
  • Tools
    • Selenium
      • Selenium Java Tutorial
      • Selenium C# Tutorial
    • Appium
      • Appium Java Tutorial
      • Appium C#Tutorial
    • Katalon
  • Trainings
  • TestNG
  • Reports
    • Extent Reports
      • Extent Reports – Java
      • Extent Reports – Java -Version3
      • Extent Reports – C#
    • Vigo Reports
    • AT Excel Report
  • Excel
    • Apache POI – Java
    • Excel With C#
  • Interview Questions
    • Selenium Interview Questions
    • Java Interview Questions
    • C# Interview Questions
  • Demo Site
  • Practice Site
  • More…
    • AutoIt
    • Sikuli
    • Robot Class
    • File Upload
    • ScreenShot
      • AShot
      • ShutterBug
  • About
October 22, 2018

How to Take Full Page Screenshot using Selenium ShutterBug




How to Take Full Page Screenshot using Selenium ShutterBug will discuss how we can take a screenshot of a particular web page from top to bottom by scrolling till  the end of the page while working with selenium.

There are many pages in our WWW(World Wide Web) which are longer than our screen size . We have scroller to scroll down and see the content of web page. There will be few instances where you need to take screenshot of entire page during your automation tweaks. Using Selenium you can take screenshots for only visible content of page. There are different routes to capture full page screenshot using different jar files like Ashot(discussed in previous blog). Here is one more awesome and simple way to capture full page screenshot using Shutterbug. Let’s start looking into it.

We recommend you to refer our previous blog for better understanding.



To start with it , Add below dependency to maven project  or Download jar files here.

<!-- https://mvnrepository.com/artifact/com.assertthat/selenium-shutterbug -->
<dependency>
    <groupId>com.assertthat</groupId>
    <artifactId>selenium-shutterbug</artifactId>
    <version>${version}</version>
</dependency>

Syntax:

Shutterbug.shootPage(<driver>,<scrollingstategy>,<time>,true).withName(<desiredName>).save();

In above syntax, shoot page is a method which captures screenshot by scrolling page for specific time. withName method assigns desired name to screenshot take by shootpage method.Save method creates a folder with folder name as  “screenshots” and saves screenshot in that folder.

Sample Code:

public class ShutterbugFullPageScreenshot{

@Test
public void capturefullPageScreenshotwithDesiredName()
{
       WebDriverManager.chromedriver().setup();
       WebDriver driver = new ChromeDriver();
       driver.get("http://automationtesting.in");
       Shutterbug.shootPage(driver,ScrollStrategy.BOTH_DIRECTIONS,500,true).withName("FullPageScreenshot").save();
       driver.quit();
  }
}

“Shutterbug.shootPage(driver).withName(“automationtestingscreenshot”).save()”  will take full page screenshot and saves it with “FullPageScreenshot” name under screenshots folder.



MonoChrome your Logo in your full page screenshot:

With Shutterbug you can monochrome desired elements in screenshot. Which makes  verification easy when you review your screenshots. Let’s go with it

Syntax:

Shutterbug.shootPage(driver,ScrollStrategy.BOTH_DIRECTIONS,500,true).monochrome(<element>).withName("<desiredName>").save();

In above syntax, shoot page is a method which captures screenshot by scrolling page for specific time. withName method assigns desired name to screenshot take by shootpage method. Monochrome method will turn your webelement in Black & White. Save method creates a folder with folder name as  “screenshots” and saves screenshot in that folder.

Sample Code:

public class ShutterbugFullPageScreenshotwithMonoChrome {

@Test
public void capturefullPageScreenshotwithDesiredName()
{
     WebDriverManager.chromedriver().setup();
     WebDriver driver = new ChromeDriver();
     driver.get("http://automationtesting.in");
     WebElement QuestionsLogo = driver.findElement(By.xpath("//img[@alt='Interview Questions']"));
     Shutterbug.shootPage(driver,ScrollStrategy.BOTH_DIRECTIONS,500,true).monochrome(QuestionsLogo).withName("FullPageScreenshotMonogram").save();
     driver.quit();
  }
}

Output Screenshot :

full page screenshot

Reference Link:

https://github.com/assertthat/selenium-shutterbug



Share this post: on Twitter on Facebook on Google+

How to Take WebElement Screenshot using Selenium ShutterBug Image Comparison Using Selenium Shutterbug

Related Posts

image comparison

ShutterBug

Image Comparison Using Selenium Shutterbug

How to Take WebElement Screenshot using Selenium ShutterBug

ShutterBug

How to Take WebElement Screenshot using Selenium ShutterBug

take screenshot

ShutterBug

How to Take Screenshot using Selenium ShutterBug

Newsletter

Recent Posts

  • TAKING WEB ELEMENT SCREENSHOT IN SELENIUMHow to Capture WebElement Screenshot in Selenium Webdriver using selenium 4
    December 15, 2019
  • How To SWAP Two Numbers in Java Without using Temp VariableHow to SWAP Two Numbers in Java Without Temp variable or Without Third variable
    December 8, 2019
  • How to Swap Two Numbers in Java with Temp VariableHow to SWAP Two Numbers in Java using Temp Variable
    December 1, 2019
  • How to Read Properties file in JavaHow to Read Data From Properties File in Java
    November 27, 2019
  • Compare two arrays in java with out inbuilt functionsHow to Compare Two Arrays in Java without built-in functions
    November 16, 2019
© Selenium Webdriver Appium Complete Tutorial 2023