Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java =================================================================== diff -u -r18571 -r18632 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 18571) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 18632) @@ -1,7 +1,15 @@ package test.forgon.disinfectsystem.selenium; +import java.io.File; +import java.io.IOException; +import java.security.Timestamp; +import java.text.SimpleDateFormat; + +import org.apache.commons.io.FileUtils; import org.apache.log4j.Logger; import org.openqa.selenium.By; +import org.openqa.selenium.OutputType; +import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.testng.AssertJUnit; @@ -379,6 +387,20 @@ @AfterTest public void afterMethod() { - Utils.driver.quit(); + try { + File scrFile = ((TakesScreenshot) Utils.driver) + .getScreenshotAs(OutputType.FILE); + // Now you can do whatever you need to do with it, for example copy + // somewhere + + String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss") + .format(new java.util.Date()); + FileUtils.copyFile(scrFile, new File("c:\\temp\\screenshot-" + + timeStamp + ".png")); + } catch (Exception e) { + e.printStackTrace(); + } + +// Utils.driver.quit(); } }