Posts

Showing posts from May, 2012

Selenium WebDriver : - How to capture screenshot

Selenium WebDriver : - How to capture screenshot Java code to capture browser screen shot is as follows –

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); //take picture of browser screenshotpath = "C:\\”+ "file1.png"; //path & file name of picture try {   FileUtils.copyFile(scrFile, newFile(screenshotpath)); //.png file is copied from memory   to file system } catch (IOException e) {             e.printStackTrace();
}