|
2 | 2 |
|
3 | 3 | [](https://travis-ci.org/assertthat/selenium-shutterbug)
|
4 | 4 |
|
5 |
| -Utility library to create customised screenshots using Selenium WebDriver |
| 5 | +## Synopsis |
6 | 6 |
|
7 |
| -Key features: |
| 7 | +Selenium Shutterbug is a utility library make screenshots using [Selenium WebDriver](http://www.seleniumhq.org/projects/webdriver/ "SeleniumHQ WebDriver page") and further customize, compare and process them with the help of [Java AWT](https://en.wikipedia.org/wiki/Abstract_Window_Toolkit "AWT wiki"). |
8 | 8 |
|
9 |
| -- Full page screenshot in Chrome |
10 |
| -- Highlight WebElement on screenshot |
11 |
| -- Highlight WebElement and add text to screenshot |
12 |
| -- Make screenshot/element 'monochrome' |
13 |
| -- Blur screenshot or specified WebElement on it |
14 |
| -- Make thumbnail of processed screenshot |
| 9 | +## Code Example |
15 | 10 |
|
16 |
| -_Work in progress ..._ |
| 11 | +Screenshot of the page, saving to default location (./screenshots/): |
| 12 | +```` |
| 13 | +Shutterbug.shootPage(driver).save();; |
| 14 | +``` |
| 15 | +Screenhot of the page with scrolling (for chrome to make screenshot of the whole page but not viewport only): |
| 16 | +``` |
| 17 | +Shutterbug.shootPage(driver, ScrollStrategy.BOTH_DIRECTIONS).save("C:\\testing\\screenshots\\"); |
| 18 | +``` |
| 19 | +Screenshotof the single element: |
| 20 | +``` |
| 21 | +Shutterbug.shootElement(driver,element).save("C:\\testing\\screenshots\\"); |
| 22 | +``` |
| 23 | +
|
| 24 | +Highlighting, adding titles, text, etc: |
| 25 | +``` |
| 26 | +Shutterbug.shootPage(driver, ScrollStrategy.BOTH_DIRECTIONS) |
| 27 | + .highlight(element) |
| 28 | + .blur() |
| 29 | + .highlightWithText(otherElement, "This is element I was searching for") |
| 30 | + .monochrome() |
| 31 | + .withTitle("Home page screensho") |
| 32 | + .withName("home_page") |
| 33 | + .withThumbnail(0.4).save("C:\\testing\\screenshots\\"); |
| 34 | +``` |
| 35 | +
|
| 36 | +And much more... |
| 37 | +
|
| 38 | +## Motivation |
| 39 | +
|
| 40 | +The idea behing 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 time. |
| 41 | +
|
| 42 | +## Installation |
| 43 | +
|
| 44 | +The project is available in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22selenium-shutterbug%22 "Maven Central project location") |
| 45 | +
|
| 46 | +#####Maven dependency |
| 47 | +
|
| 48 | +```xml |
| 49 | +<dependency> |
| 50 | + <groupId>com.assertthat</groupId> |
| 51 | + <artifactId>selenium-shutterbug</artifactId> |
| 52 | + <version>x.x</version> |
| 53 | +</dependency> |
| 54 | +``` |
| 55 | +#####Using Gradle |
| 56 | +
|
| 57 | +``` |
| 58 | +compile 'com.assertthat:selenium-shutterbug:0.1' |
| 59 | +``` |
| 60 | +
|
| 61 | +## License |
| 62 | +
|
| 63 | + Code released under the [MIT license](https://github.com/assertthat/selenium-shutterbug/blob/master/LICENSE "MIT license") |
0 commit comments