我对Ubuntu 14.04上的selenium web driver启动有问题。 我已经安装了Oracle JDK和Selenium Standalone Server,在Ubuntu 14.04上运行Selenium Standalone Server也没有问题(我使用的是cloud9 VDS)。
但是当我尝试运行this example时发生错误(无法创建新服务):
Fatal error: Uncaught exception 'Facebook\WebDriver\Exception\SessionNotCreatedException' with message ' in /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 154 Facebook\WebDriver\Exception\SessionNotCreatedException: Unable to create new service: ChromeDriverService Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:08.936Z' System info: host: 'user-selenium-6138185', ip: '173.18.0.42', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.80-c9', java.version: '1.8.0_171' Driver info: driver.version: unknown in /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Exception/WebDriverException.php on line 154 Call Stack: 0.0005 234144 1. {main}() /home/ubuntu/workspace/php-web-driver-test/test-1.php:0 0.0020 307072 2. Facebook\WebDriver\Remote\RemoteWebDriver::create() /home/ubuntu/workspace/php-web-driver-test/test-1.php:11 0.0030 387224 3. Facebook\WebDriver\Remote\HttpCommandExecutor->execute() /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126 0.1971 486960 4. Facebook\WebDriver\Exception\WebDriverException::throwException() /home/ubuntu/workspace/php-web-driver-test/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:320
Selenium Server也有一些回复:
06:04:33.192 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
06:04:33.194 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2018-05-16 06:04:33.330:INFO::main: Logging initialized @566ms to org.seleniumhq.jetty9.util.log.StdErrLog
06:04:33.641 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
06:04:42.085 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: chrome}
06:04:42.088 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
我不知道为什么会出现这样的错误,可能是我必须强制使用浏览器无头模式选项或为网络驱动程序指定精确的firefox或chrome位置?