yii 与chromediver欺骗- Chrome无法启动:异常退出

ru9i0ody  于 2022-11-09  发布在  其他
关注(0)|答案(1)|浏览(133)

我试着运行验收测试。

接受.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的问题?如何找到解决方案?谢谢

dzhpxtsq

dzhpxtsq1#

添加“no-sandbox”和“headless”参数到chromeOptions部分,我改变了你的接受度。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:

相关问题