To take screenshot with selenium we can do so using below two lines of code
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scrFile, new File("c:\\SCREENSHOTS\\"+filename+".png"));