Webdriver Screenshot

后端 未结 12 818
南方客
南方客 2020-11-30 00:57

When taking a screenshot using Selenium Webdriver on windows with python, the screenshot is saved directly to the path of the program, is there a way to save the .png file t

12条回答
  •  既然无缘
    2020-11-30 01:36

    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com/");
    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(scrFile, new File("c:\\NewFolder\\screenshot1.jpg"));
    

提交回复
热议问题