Wednesday, 16 January 2013

How to take screenshot using selenium Webdriver?

How to take screenshot using selenium Webdriver?


By Using  below code you can take screenshot of current webpage:

driver.get("http://google.com");            
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("E://google.png"));