I am getting failure exception while taking the device screenshots
my code as below:
//open the page
driver.get("http://wikipedia.com");
//take another screenshot
try {
File screenshot = new File("screenshot1.png");
File tmpScreenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
}
catch(IOException e){
System.out.println("Failed to take screenshot."+e.getMessage());
}
//quit
driver.quit();
}
Can any body help me out this issue?
I tried to execute your code but didn’t get the exception, although i didn’t get the screenshot either. I have modified your code a bit see if this work for you