Capture the screenshots that You would need to copy the file somewhere else with a different name. The following code help to you.
Create the method of any name. I am creating here captureScreenshot method.
public static void captureScreenshot(String path) throws IOException{
try{
File scrFile= ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File(path) );
}
catch (Exception e){
System.out.println("Failed to capture screenshot");
}
}
Then use this method in your method where you want to take the screenshots. Refer the following line of code. Here I am using the system current time in milliseconds for to save the multiple Images with different name.
captureScreenshot("././screenshots/loginerror_" + System.currentTimeMillis()+".jpg");
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/6aa4e847-643e-4cba-95a7-363644db0935%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.