Thursday 5 February 2015

How to capture screenshot in WebDriver?



public void test() throws IOException {
            // Code to capture the screenshot File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
            // Code to copy the screenshot in the desired location
FileUtils.copyFile(scrFile, new File("C:\\CaptureScreenshot\\google.jpg"));                  
     }

No comments:

Post a Comment