Selenium + facebook php-webdriver:无法创建新服务:ChromeDriverService

时间:2018-04-15 18:26:58

标签: selenium-webdriver

我正在尝试使用facebook php-webdriver设置Selenium。这就是我所做的:

  • Ran作曲家需要facebook / webdriver来安装包
  • 在端口4444上启动了selenium服务器(默认)
  • enter link description here下载最新的32位chromedriver(没有单独的64位可用)
  • 将chromedriver.exe复制到项目文件夹(不知道是否有必要)
  • 陈述的chromedriver。它默认在端口9515上运行。
  • 让脚本打开Chrome浏览器窗口。

在我的下面的脚本中,我在第三行收到错误

$host = 'http://localhost:4444/wd/hub'; // this is the default
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities);

错误:

Fatal error: Uncaught Facebook\WebDriver\Exception\SessionNotCreatedException: Unable to create new service: ChromeDriverService Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z' System info: host: 'WINCOM', ip: '192.168.0.10', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '9.0.1' Driver info: driver.version: unknown in C:\xampp\htdocs\xampp\testnew\vendor\facebook\webdriver\lib\Exception\WebDriverException.php:154 Stack trace: #0 C:\xampp\htdocs\xampp\testnew\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php(320): Facebook\WebDriver\Exception\WebDriverException::throwException(33, 'Unable to creat...', Array) #1 C:\xampp\htdocs\xampp\testnew\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php(126): Facebook\WebDriver\Remote\HttpCommandExecutor->execute(Object(Facebook\WebDriver\Remote\WebDriverCommand)) #2 C:\xampp\htdocs\xampp\testnew\test.php(11): Facebook\WebDriver\Remote\RemoteWebDriver::create('http://localhos...', Object(Facebook\WebDriver in C:\xampp\htdocs\xampp\testnew\vendor\facebook\webdriver\lib\Exception\WebDriverException.php on line 154

在Selenium终端,我看到了这样的信息:

14:18:08.607 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider:org.openqa.selenium.chrome.ChromeDriverService)

任何人都可以指导我如何解决这个问题。我到处都看,但似乎没什么用。

由于

1 个答案:

答案 0 :(得分:0)

我有完全一样的问题。 看来您应该将chrome网络驱动程序可执行文件和脚本放在同一文件夹中。