我试过了
$capabilities = DesiredCapabilities::htmlUnitWithJS();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
...
$driver->takeScreenshot('tmp.png');
但它失败了这个错误
PHP 致命错误:在 /cygdrive/c/Users/Chloe/workspace/Teads/php-webdriver 中无法将消息“org.openqa.selenium.htmlunit.HtmlUnitDriver”的未捕获异常“UnknownServerException”强制转换为 org.openqa.selenium.TakesScreenshot /lib/WebDriverExceptions.php:79
(在 Google http://goo.gl/9SyjvO中没有结果。)这就是文档所说的使用它的方式。
https://github.com/facebook/php-webdriver/wiki/Taking-Full-Screenshot-and-of-an-Element
Selenium 的版本是 selenium-server-standalone-2.45.0.jar