Skip to content

Custom screenshot capturing

Marián Labuda edited this page Jul 15, 2015 · 1 revision

Since RedDeer 0.8.0 it is possible to create a screenshot from your code. Class ScreenshotCapturer providing this functionality is located in JUnit plugin in package org.jboss.reddeer.junit.screenshot.

To successfully capture a screenshot of your screen during the test execution use method captureScreenshot(String fileName). Screenshots are captured as .png images and they are stored in ./target/custom-screenshots/ directory by default. If you want to change directory where to store screenshots, provide full file name containing path to your directory. E.g. for storage of screenshots to directory ./my-plugin-screenshots/ use following code:

ScreenshotCapturer capturer = ScreenshotCapturer.getInstance();
capturer.captureScreenshot("./my-plugin-screenshots/screenshotOfPlugin");
Clone this wiki locally