Take a screenshot with Selenium WebDriver

0
0

Does anyone know if it’s possible to take a screenshot using Selenium WebDriver? (Note: Not Selenium RC)

  • You must to post comments
0
0

Java

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"));
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website