Explain me how can we capture screenshots in Selenium?

Submitted by: Muhammad
We can take the screenshots in selenium by using getScreenshotAs method of TakesScreenshot interface:

File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("C:screenshot1.jpg"));
Submitted by: Muhammad

Read Online Automation Job Interview Questions And Answers