Taking ScreenShot ONLY for Failed Tests

We have discussed about simple way of taking a screen shot earlier. Now in this tutorial, we will see how to take screen shot ONLY for failed tests.Read More »


ScreenShot in Selenium Webdriver

// store screenshots
public static void captureScreenShot(String filePath) {
File scrFile = ((TakesScreenshot)driver). getScreenshotAs (OutputType.FILE);
try {
FileUtils.copyFile(scrFile, new File(filePath));
} catch (IOException e) {