【问题标题】:codeception with chromediver - Chrome failed to start: exited abnormally使用 chromediver 进行代码接收 - Chrome 无法启动:异常退出
【发布时间】:2017-11-17 13:57:34
【问题描述】:

我尝试运行验收测试。

acceptance.suite.yml

class_name: AcceptanceTester
modules:
    enabled:
      - WebDriver:
            url: 'http://localhost/'
            window_size: false # disabled in ChromeDriver
            port: 9515
            browser: chrome
      - \Helper\Acceptance        
    config:

接下来我运行 chromedriver:

vagrant@homestead:/usr/local/bin$ chromedriver --url-base=/wd/hub
Starting ChromeDriver 2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5) on port 9515
Only local connections are allowed.

接下来,我运行 Xvfb:

Xvfb :0 -ac -screen 0 1280x960x24 &

最后我开始测试:

codecept run acceptance

得到错误:

[Facebook\WebDriver\Exception\UnknownServerException]                                                                        
  unknown error: Chrome failed to start: exited abnormally                                                                     
    (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-92-generic x86_64)

如何解决 chromedriver 的问题?如何找到解决方案?谢谢

【问题讨论】:

    标签: php yii yii2 selenium-chromedriver codeception


    【解决方案1】:

    将“no-sandbox”和“headless”参数添加到 chromeOptions 部分对我来说是诀窍 像这样改变你的acceptance.suite.yml

    class_name: AcceptanceTester
    modules:
        enabled:
          - WebDriver:
                url: 'http://localhost/'
                window_size: false # disabled in ChromeDriver
                port: 9515
                browser: chrome
                capabilities:
                  chromeOptions:
                    args: [ "no-sandbox", "headless", "disable-gpu" ]
          - \Helper\Acceptance        
        config:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-06
      • 2014-04-20
      • 1970-01-01
      • 2016-10-08
      • 1970-01-01
      相关资源
      最近更新 更多