Taking snapshot in Webdriver


// Creating webdriver object
  FirefoxDriver driver = new FirefoxDriver();
  driver.get("http://rediff.com");
  
  // Taking screenshot in Webdriver 
  File outSnapshot = driver.getScreenshotAs(OutputType.FILE);
  
  // Use FileUtils class to copy snapshot taken in previous step to my disk
  FileUtils.copyFile(outSnapshot, new File("C:\\snaps.png"));

No comments :

No comments :

Post a Comment