Automation Question:
Explain me how can we capture screenshots in Selenium?
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"));
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new File("C:screenshot1.jpg"));
Previous Question | Next Question |
Please explain what is the difference between findElement () and findElements ()? | Tell me how would you test your own element locator? |