Selenium Shutterbug is a utility library written in Java for making screenshots using Selenium WebDriver and further customizing, comparing and processing them with the help of Java AWT.
Screenshot of the page with scrolling (for Chrome to make screenshot of the whole page but not viewport only):
Shutterbug.shootPage(driver, ScrollStrategy.WHOLE_PAGE).save("C:\\testing\\screenshots\\");
Highlighting, adding titles, text, etc:
Shutterbug.shootPage(driver)
.blur(searchBox)
.highlight(searchBtn)
.monochrome(googleLogo)
.highlightWithText(googleLogo, Color.blue, 3, "Monochromed logo",Color.blue, new Font("SansSerif", Font.BOLD, 20))
.highlightWithText(searchBox, "Blurred secret words")
.withTitle("Google home page - " + new Date())
.withName("home_page")
.withThumbnail(0.7)
.save("C:\\testing\\screenshots\\");
More examples here
The idea behind the project is to make testers life easier by enabling them to create descriptive screenshots which, in some cases, could be directly attached to the bug reports or serve as a source of information about system state at a specific moment of time.
The project is available in Maven Central
<dependency>
<groupId>com.assertthat</groupId>
<artifactId>selenium-shutterbug</artifactId>
<version>x.x</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</exclusion>
</exclusions>
</dependency>
compile ('com.assertthat:selenium-shutterbug:x.x') {
exclude group: "org.seleniumhq.selenium", name: "selenium-java"
}
"com.assertthat" % "selenium-shutterbug" % "x.x" exclude("org.seleniumhq.selenium", "selenium-java"),
For details please read CONTRIBUTING
Code released under the MIT license