Wednesday 24 September 2014

How to take screenshot of the page?

WebDriver driver = new FirefoxDriver();

driver.get("http://google.com/");

//Get the screenshot as file
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
  
// Copy the screenshot to your file system
FileUtils.copyFile(scrFile, new File("c:\screenshots\screenshot.png"));

No comments:

Post a Comment