Take Screenshot and save to Local Folder using Java and Selenium Webriver

import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; public class ImageSave { String imageName = System.currentTimeMillis() + “.png”; public void addScreenshot(WebDriver driver) throws IOException, ClassNotFoundException, InterruptedException { File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scrFile, new File(“C://screenshot//” + imageName)); } } Notify me of follow-up comments by email. Notify me of new posts by email.

Δ

How to Take Screenshot and save to Local Folder using Java and Selenium Webriver - 81How to Take Screenshot and save to Local Folder using Java and Selenium Webriver - 18How to Take Screenshot and save to Local Folder using Java and Selenium Webriver - 69How to Take Screenshot and save to Local Folder using Java and Selenium Webriver - 66