Taking Screenshot and Saving Screenshot (WebDriver) - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Monday 23 September 2013

Taking Screenshot and Saving Screenshot (WebDriver)

Snippet for Taking Screenshot and Saving Screenshot



import java.io.File;
import org.apache.commons.io.FileUtils;


File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("C:\\Users\\neeraj.bakhtani\\Desktop\\Untitled.jpg"));

No comments:

Post a Comment