PHP Fatal error: Uncaught
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for
http POST to /session with params: {"desiredCapabilities":
{"browserName":"chrome","platform":"ANY"}}
我有这个错误。 Platform Linux,OS Ubuntu 16.04。 Php脚本:
require_once '/var/www/html/vendor/autoload.php';
$host = 'http://127.0.0.1:4444/wd/hub';
$driver = \Facebook\WebDriver\Remote\RemoteWebDriver::create($host,
\Facebook\WebDriver\Remote\DesiredCapabilities::firefox());
print_r($driver);
我已经安装了Google Chrome最新版本和chromedriver最新版本的linux 64。
我用这段代码运行了selenium:
DISPLAY=:99 xvfb-run -a -n 1 -l -s "-screen 0, 1024x768x8" java -Dwebdriver.chrome.driver="/var/www/html/chromedriver-linux" -jar /var/www/html/selenium-server.jar
答案 0 :(得分:0)
我修复了错误:
$options = new
\Facebook\WebDriver\Chrome\ChromeOptions();
$options->addArguments(array(
'--no-sandbox',
));
我也将webdriver更改为2.29,并以可执行权限将其放入/ usr / local / bin。
我将运行Xvfb更改为
Xvfb :99 -screen 0 1280x1024x24 -ac &
比
export DISPLAY=:99 && java -Dwebdriver.chrome.driver="/usr/local/bin/chromedriver-229" -jar /usr/local/bin/selenium-server.jar
现在,它运行良好。