Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.4k points)

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

1 Answer

0 votes
by (27.5k points)

WebDriver driver = new FirefoxDriver();

driver.get("http://www.google.com/");

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);

//you can further operations with it, for example copy somewhere

FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...