How to get screenshot of full webpage using Selenium and Java?

前端 未结 9 726
耶瑟儿~
耶瑟儿~ 2020-12-29 08:17

How to take a screenshot of the entire web page (full-page screenshot), not only partial (top-to-bottom) using Selenium WebDriver?

My code:

9条回答
  •  梦毁少年i
    2020-12-29 09:05

    File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(scrFile, new File("c:\\RESULT_FILENAME.png"));
    

    Try this

提交回复
热议问题