File source;
source = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
String dest=System.getProperty("user.dir") + "/errorscreenshot/" + screenshotname + ".png";
File destination=new File(dest);
FileUtils.copyFile(source, destination);