📌  相关文章
📜  如何在 selenium 中截取屏幕截图 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:21.629000             🧑  作者: Mango

代码示例1
Java
Yes, it is possible. The following example is in Java:

WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com/");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));