Capturing Screenshot using Selenium ShutterBug



Capturing Screenshot using Selenium ShutterBug

In this Blog, we are going to learn how we can capture screenshot of a web page using Selenium Shutterbug.

Before Moving further let's understand what is Shutterbug and why it is required.

Selenium Shutterbug is a utility library written in Java for taking screenshots using Selenium Web Driver and further customizing, comparing and processing them.



With Shutterbug, we can also capture screenshot of particular web element, highlight them, screenshot comparison etc.

Please visit the official GitHub Page of Shutterbug for more details.

To Start with Shutterbug we need to add below maven dependency or Jar. You can also download them from the Maven Repository using the link.


Below is the detailed code snippet for capturing screenshot of Google homepage and storing it in a local machine.


In the above code shoot page is a method that captures the screenshot. withName method assigns the desired name to screenshot take by shootpage method and Save method creates a new folder with folder name as “screenshots” and saves screenshot in that folder.




Happy Learning J





SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post