Does anyone know if it's possible to take a screenshot using Selenium WebDriver? (Note: Note Selenium RC)
+2
A:
Yes, it is possible. The following example is in Java:
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com/");
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("c:\\tmp\\screenshot.png"));
ZloiAdun
2010-08-06 11:33:22
A:
There is another question with sample in C#: http://stackoverflow.com/questions/3346017/best-way-to-take-screenshots-of-tests-in-selenium-2
dkl
2010-08-28 20:34:35