Wednesday 29 July 2015

Screenshot of page Using WebDriver

 public void takeScreenshot() throws IOException {
    File scrFile = ((TakesScreenshot) driver)
        .getScreenshotAs(OutputType.FILE);
    String fileName = UUID.randomUUID().toString();
    File targetFile = new File("target/screenshots/" + fileName
        + ".jpg");
    FileUtils.copyFile(scrFile, targetFile);
  }

No comments:

Post a Comment