我的代码:
Robot robot = new Robot();
//capture a screenshot of desktop size
Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture = robot.createScreenCapture(captureSize);
//save to file
ImageIO.write(capture, "bmp", new File(image12345 + ".jpg")));
以下代码有效,但我需要捕获整个屏幕,包括URL:
File scrFile = ((TakesScreenshot) BrowserFactory.getDriver()).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile,
new File((test12345 + ".jpeg")));
为什么会发生这种情况?
感谢您的帮助