I'm new to Selenium. I need to know how to take the screenshot while popping up the error message. I've browsed in web and used the below codes which is not satisfying my requirements
File src=screenshot.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src, new File("D:\\"+result.getName()+".png"));
The above code is not capturing the pop-up msg. It is just capturing the behind screen only.
BufferedImage image = new Robot().createScreenCapture(new Rectangle(tk.getScreenSize()));
ImageIO.write(image, "JPG", new File("D:\\"+formatter.format(now.getTime())+".jpg"));
Robo screenshot is not working when I switched to some other screen. SO when the error occurs it is just capturing the present screen.
Someone please give me the code snippet?