【问题标题】:Curl error with selenium硒的卷曲错误
【发布时间】:2018-11-27 17:33:42
【问题描述】:
PHP Fatal error:  Uncaught 
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for 
http POST to /session with params: {"desiredCapabilities": 
{"browserName":"chrome","platform":"ANY"}}    

我遇到了这个错误。平台 Linux,操作系统 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 最新版本 for 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

【问题讨论】:

    标签: php google-chrome selenium selenium-chromedriver


    【解决方案1】:

    我修复错误:

    $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
    

    现在,它运行良好。

    【讨论】:

      猜你喜欢
      • 2015-06-06
      • 1970-01-01
      • 2017-07-06
      • 2015-04-18
      • 1970-01-01
      • 2016-06-30
      • 2021-05-30
      • 1970-01-01
      • 2015-12-12
      相关资源
      最近更新 更多