PHP Fatal error: Uncaught
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for
http POST to /session with params: {"desiredCapabilities":
{"browserName":"chrome","platform":"ANY"}}
I have got this error. Platform Linux, OS Ubuntu 16.04. Php script:
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);
I have been installed Google Chrome latest version and chromedriver latest version for linux 64.
I was run selenium with this code:
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
I fix error:
$options = new
\Facebook\WebDriver\Chrome\ChromeOptions();
$options->addArguments(array(
'--no-sandbox',
));
Also I changed webdriver to 2.29 and put it into /usr/local/bin with executable permission.
I changed running Xvfb to
Xvfb :99 -screen 0 1280x1024x24 -ac &
And than
export DISPLAY=:99 && java -Dwebdriver.chrome.driver="/usr/local/bin/chromedriver-229" -jar /usr/local/bin/selenium-server.jar
Now, it working good.