How can we capture screenshots in selenium?



How can we capture screenshots in selenium?..

Answer / Navneet Kumar

To capture a screenshot in Selenium, you can use the `TakesScreenshot` interface. Here's an example:
```
FileUtils.copyFile(driver.getScreenshotAs(OutputType.FILE), new File("screenshots/screenshot.png"));
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Selenium Interview Questions

How you can handle frames using selenium 2.0?

1 Answers  


Explain what is the difference between find elements () and find element ()?

1 Answers  


What is object repository? How can we create an object repository in selenium?

1 Answers  


What test can selenium perform?

1 Answers  


What is an implicit wait in selenium?

1 Answers  


Have you created any framework?

0 Answers  


Describe the purpose of xpath.

1 Answers  


Tell me how you can capture server side log selenium server?

1 Answers  


How can we handle windows based pop up?

1 Answers  


What is group test in testng?

1 Answers  


What is the alternative to driver.get() method to open an url using selenium webdriver?

1 Answers  


What are the operating systems supported by selenium webdriver?

1 Answers  


Categories