Skip to content

Instantly share code, notes, and snippets.

@kasimok
Created December 19, 2016 00:21
Show Gist options
  • Save kasimok/d1aee51c3a8a845188f1d0140fd276df to your computer and use it in GitHub Desktop.
Save kasimok/d1aee51c3a8a845188f1d0140fd276df to your computer and use it in GitHub Desktop.
Selenium Driver take screenshot
driver.manage().window().setSize(new Dimension(1920,1080));
driver.get("http://adultimages.org");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(scrFile, new File("./screenshot.png"));
driver.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment