Robot robot = new Robot();
BufferedImage screenShot = robot.createScreenCapture(new
Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(screenShot, "JPG", new File("ScreenShot.jpg"));
This code will capture the screenshot of whatever is present on the desktop screen when test cases fail. But I need to take screenshot of chromedriver browser screen with URL. How can I capture the error scenario in selenium?