如何使用PHP Selenium WebDriver HTMLUnitWithJS截取屏幕截图?

时间:2015-03-27 21:45:22

标签: php selenium selenium-webdriver webdriver remotewebdriver

我试过

$capabilities = DesiredCapabilities::htmlUnitWithJS();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
...
$driver->takeScreenshot('tmp.png');

但它失败并出现此错误

  

PHP致命错误:未捕获的异常' UnknownServerException'消息' org.openqa.selenium.htmlunit.HtmlUnitDriver无法转换为org.openqa.selenium.TakesScreenshot'在/cygdrive/c/Users/Chloe/workspace/Teads/php-webdriver/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

0 个答案:

没有答案