Utility library to create customized screenshots using Selenium WebDriver and Java AWT
Clone or download

README.md

selenium-shutterbug

Build Status

Synopsis

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.

Code Example

Screenhot of the page with scrolling (for Chrome to make screenshot of the whole page but not viewport only):

Shutterbug.shootPage(driver, ScrollStrategy.BOTH_DIRECTIONS).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

Motivation

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.

Installation

The project is available in Maven Central

Maven dependency
<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>
Using Gradle
compile ('com.assertthat:selenium-shutterbug:x.x') {
    exclude group: "org.seleniumhq.selenium", name: "selenium-java"
    }
Using SBT
"com.assertthat" % "selenium-shutterbug" % "x.x" exclude("org.seleniumhq.selenium", "selenium-java"),

Contributing

For details please read CONTRIBUTING

License

Code released under the MIT license