diff --git a/src/test/java/com/lazerycode/selenium/listeners/ScreenshotListener.java b/src/test/java/com/lazerycode/selenium/listeners/ScreenshotListener.java index 30bc7a04..2bb2bef1 100644 --- a/src/test/java/com/lazerycode/selenium/listeners/ScreenshotListener.java +++ b/src/test/java/com/lazerycode/selenium/listeners/ScreenshotListener.java @@ -49,7 +49,7 @@ private void writeScreenshotToFile(WebDriver driver, File screenshot) { public void onTestFailure(ITestResult failingTest) { try { WebDriver driver = getDriver(); - String screenshotDirectory = System.getProperty("screenshotDirectory"); + String screenshotDirectory = System.getProperty("screenshotDirectory", "target/screenshots"); String screenshotAbsolutePath = screenshotDirectory + File.separator + System.currentTimeMillis() + "_" + failingTest.getName() + ".png"; File screenshot = new File(screenshotAbsolutePath); if (createFile(screenshot)) {