Is it possible to take a screenshot using Selenium WebDriver?
(Note: Not Selenium Remote Control)
I used this method for taking a screenshot.
void takeScreenShotMethod(){
try{
Thread.sleep(10000)
BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(image, "jpg", new File("./target/surefire-reports/screenshot.jpg"));
}
catch(Exception e){
e.printStackTrace();
}
}
You may use this method wherever required.