How can I take a screenshot with Selenium WebDriver?

后端 未结 30 2597
不知归路
不知归路 2020-11-21 07:48

Is it possible to take a screenshot using Selenium WebDriver?

(Note: Not Selenium Remote Control)

30条回答
  •  天涯浪人
    2020-11-21 08:37

    Java

    I got this issue resolved. You can augment the RemoteWebDriver to give it all of the interfaces its proxied driver implements:

    WebDriver augmentedDriver = new Augmenter().augment(driver);
    ((TakesScreenshot)augmentedDriver).getScreenshotAs(...); // It works this way
    

提交回复
热议问题