使用 Chrome Diver 进行编码处理 - Chrome 无法启动:异常退出



我尝试运行验收测试。

acceptance.suite.yml

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

接下来我运行铬驱动程序:

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

获取错误:

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

如何解决铬驱动程序的问题?如何找到解决方案?谢谢

将"no-sandbox"和"lessless"参数添加到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" ]
      - HelperAcceptance        
    config:

最新更新