截图似乎在PhantomJS上搞砸了,我使用的是selenium 3.3.1和PhantomJS 2.1.1。
代码段:
DesiredCapabilities caps = DesiredCapabilities.phantomjs();
caps.setJavascriptEnabled(true);
caps.setCapability("takesScreenshot", true);
WebDriver driver = new PhantomJSDriver(caps);
String screenShot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64);