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

Jenkins中webdriver-manager更新geckodriver失败及执行异常求助

Troubleshooting Your Jenkins + Protractor + Geckodriver Issues

Let’s work through each of your problems one by one to get your e2e tests running smoothly in Jenkins:

1. Fixing the Geckodriver 403 Download Error

The tunneling socket could not be established, statusCode=403 error happens because your proxy isn’t properly handling requests to GitHub’s API (where geckodriver is hosted), while it works fine for Chrome’s driver storage. Here’s how to resolve it:

  • Update proxy configuration: Ensure your Jenkins global proxy settings allow access to api.github.com and github.com. If your proxy requires authentication, modify your webdriver-manager command to include credentials:
    node_modules/protractor/bin/webdriver-manager update --ignore_ssl --proxy=http://your-username:your-password@proxy-address:port --versions.gecko=v0.25.0 --versions.chrome=78.0.3904.105
    
  • Verify manual download integrity: If you stick to manual downloads, make sure you grab the Linux 64-bit version of geckodriver v0.25.0 (not a variant for another OS) and confirm the .tar.gz file isn’t corrupted. The earlier unzip failure was almost certainly due to a partial/corrupted file from the 403 error.

2. Resolving the EACCES Permission Error

The spawn ... EACCES error means the Jenkins user doesn’t have execute permissions for the geckodriver binary. Even though logs mention permissions were set to 0755, manual file placement or Jenkins file ownership can override this:

  • Manually set execute permissions: Add a shell step in your Jenkins build (before running ng e2e) to fix permissions:
    chmod +x /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0
    
  • Check file ownership: Ensure the geckodriver file is owned by the jenkins user or a group with execute access. Run this on your Jenkins node to verify:
    ls -l /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0
    
    If needed, adjust ownership with:
    chown jenkins:jenkins /var/lib/jenkins/jobs/x/workspace/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.25.0
    

3. Validating DirectConnect Configuration

Your directConnect: true is correct in theory, but Jenkins environments often need extra Firefox configuration:

  • Specify Firefox binary path: Jenkins might not have Firefox in its default PATH. Add the binary location to your protractor.conf.js:
    exports.config = {
      directConnect: true,
      capabilities: {
        browserName: 'firefox',
        'moz:firefoxOptions': {
          binary: '/usr/bin/firefox', // Replace with your actual Firefox path
          args: ['--headless', '--no-sandbox'] // Critical for headless Jenkins environments
        }
      },
      // ... other configs
    };
    
  • Confirm version compatibility: Your Firefox 60.9.0 and geckodriver v0.25.0 are compatible (v0.25.0 supports Firefox 55-70), so that’s not the root issue here.
  1. Fix your proxy settings (or use authenticated proxy) to let webdriver-manager download geckodriver correctly.
  2. Add a pre-test shell step to ensure geckodriver has execute permissions.
  3. Update your protractor config to include the Firefox binary path and headless mode arguments.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 09:11:26