Automation Question:

Explain me how can we capture screenshots in Selenium?

Automation Interview Question
Automation Interview Question

Answer:

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"));


Previous QuestionNext Question
Please explain what is the difference between findElement () and findElements ()?Tell me how would you test your own element locator?