public void takeScreenShot(){ // fileName of the screenshot Date d=new Date(); String screenshotFile=d.toString().replace(":", "_").replace(" ", "_")+".png"; // store screenshot in that file File scrFile = ((org.openqa.selenium.TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(scrFile, new File(System.getProperty("user.dir")+"//screenshots//"+screenshotFile));
} catch (IOException e) { // TODO Auto-generated catch block