0

在 OSX 本地,使用 chromedriver 的 node-huxley 工作正常。为了使用 huxley 设置 CI,我在运行 ubuntu 的弹性竹实例上安装了 chrome 和 chromedriver。我DevTools request failed一遍又一遍地查看 chromedriver 日志(在下面的完整输出中进行了删节)。我如何通过这个错误?

chromedriver 日志:

$ cat /tmp/chrome.log
[15.188][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "chromeOptions": {
         "args": [ "--test-type" ]
      }
   }
}
[15.188][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[15.188][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[15.189][INFO]: Launching chrome: /opt/google/chrome/google-chrome --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-hang-monitor --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-logging --ignore-certificate-errors --load-extension=/tmp/.com.google.Chrome.EUout2/internal --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12583 --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --test-type --use-mock-keychain --user-data-dir=/tmp/.com.google.Chrome.d9rGhd data:,
[15.190][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[15.193][WARNING]: PAC support disabled because there is no system implementation
[15.323][DEBUG]: DevTools request failed
[15.380][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[15.380][DEBUG]: DevTools request failed
[15.430][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[15.431][DEBUG]: DevTools request failed
[15.481][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[15.482][DEBUG]: DevTools request failed
[3039:3039:1121/232539:ERROR:browser_main_loop.cc(209)] Gtk: cannot open display:
[15.532][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[15.533][DEBUG]: DevTools request failed
[15.583][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[15.583][DEBUG]: DevTools request failed
[15.634][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[15.634][DEBUG]: DevTools request failed

……

[75.099][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[75.099][DEBUG]: DevTools request failed
[75.149][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[75.149][DEBUG]: DevTools request failed
[75.200][DEBUG]: DevTools request: http://127.0.0.1:12583/json/version
[75.200][DEBUG]: DevTools request failed
[75.201][INFO]: RESPONSE InitSession unknown error: Chrome failed to start: exited abnormally
[75.201][DEBUG]: Log type 'driver' lost 0 entries on destruction
[75.201][DEBUG]: Log type 'browser' lost 0 entries on destruction
4

1 回答 1

0

我在 Atalassian Answers 上发布了这个问题,并从 Atlassian 开发人员那里得到了这个回复。

看起来这个工具需要实际的 X Server 显示。为了让它在无头 Ubuntu 上运行,您需要安装 xvfb 并使用 xvfb-run 命令以虚拟显示器运行您的工具。

于 2014-12-04T23:29:15.917 回答