While executing a testcase, if the testcase fails, then we need to take a screenshot of the page for error reporting. This can also be done by using Selenium Webdriver.
We can use the following syntax for capturing and saving full page screenshot.
File screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
Then it can be stored in our local drive using the following syntax
FileUtils.copyFile(screenshot, new File(« D:screenshot.png »));
Now, here is the small example of webdriver script by which we can capture the full page screenshot.
Hope this will help you 🙂