I need to take screenshot of every page as we use to do while functional testing (before- as page loads and after- values are entered on that page) and it should name screenshot as @before- PageName and @after-PageName If anybody know how to take screenshot of whole Page, please let me know.
public void getscreenshot(WebDriver driver) throws Exception {
File scr = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
File dest = new File(("user.dir")+"screenshot" + timestamp() + ".png");
FileUtils.copyFile(scr, dest);
Thread.sleep(3000);
}