You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu下运行Protractor测试时Chrome异常退出的问题求助

Fixing Chrome Launch Failure in Protractor on Ubuntu

Hey there, let's work through this Chrome startup issue you're hitting when running Protractor tests on Ubuntu. That "exited abnormally" error is super common, and we've got a few solid fixes to try out:

1. Verify Chrome & Chromedriver Version Compatibility

First up, mismatched versions between Chrome and Chromedriver are the #1 cause of this problem. Your error shows you're using Chromedriver 2.37, which only works with Chrome versions 64-66. If your Chrome is newer (which it probably is), that's the root issue.

  • Check your current Chrome version:
    google-chrome --version
    
  • Install a Chromedriver version that matches your Chrome release. Look up the compatible version for your Chrome build, then install it via npm:
    npm install chromedriver@<your-matching-version> --save-dev
    
    For example, if you have Chrome 114.x, install Chromedriver 114.x.

2. Add Headless Mode & Critical Chrome Flags

If you're running Ubuntu without a desktop environment (like a server), Chrome can't launch in normal GUI mode. You need to enable headless mode in your Protractor config, plus a few flags to bypass common Linux-specific issues.

Update your config.js with these Chrome options:

exports.config = {
  // Your existing config (selenium address, specs, etc.)
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: [
        '--headless',    // Run Chrome without a graphical interface
        '--disable-gpu', // Disable GPU acceleration to avoid Linux bugs
        '--no-sandbox',  // Bypass sandbox restrictions (critical for root/CI users)
        '--disable-dev-shm-usage' // Fixes issues with limited shared memory space
      ]
    }
  }
};

3. Install Missing Chrome System Dependencies

Ubuntu often lacks some libraries Chrome needs to run properly. Install these core required packages first:

sudo apt-get update && sudo apt-get install -y libxss1 libappindicator1 libindicator7

If that doesn't resolve the issue, install the full set of Chrome dependencies:

sudo apt-get install -y fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

4. Fix Chromedriver Execution Permissions

Sometimes the Chromedriver binary doesn't have the necessary execution rights. Fix that with this command:

chmod +x node_modules/chromedriver/lib/chromedriver/chromedriver

If you've tried all these steps and still run into issues, feel free to share your exact Chrome version, whether you're running a desktop or server Ubuntu, and any additional error logs—we can dig deeper to get this sorted!

内容的提问来源于stack exchange,提问作者Maciek

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:05:43