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

CentOS Jenkins环境构建Maven项目遇chromedriver不可执行错误求助

Fixing "The driver is not executable: chromedriver" Error in Jenkins on CentOS

Hey there, let's work through this chromedriver permission issue—this is a super common problem when running Selenium tests on Jenkins in CentOS, and I've fixed it a bunch of times. Here's exactly what you need to do:

1. Add Executable Permissions to Chromedriver

The error directly tells us the chromedriver file doesn't have execute permissions. Run this command to grant them:

chmod +x /var/lib/jenkins/jobs/autocred-ui-automated-tests/workspace/autocredenciamento/chromedriver

2. Ensure Jenkins User Owns the File

Jenkins runs under the jenkins system user, so if the chromedriver was uploaded or created by another user (like root), Jenkins might not have access to it. Fix the file ownership with:

chown jenkins:jenkins /var/lib/jenkins/jobs/autocred-ui-automated-tests/workspace/autocredenciamento/chromedriver

3. Handle SELinux Restrictions (CentOS-Specific)

CentOS enables SELinux by default, which can block Jenkins from executing files even if filesystem permissions are correct.

First, test if SELinux is the culprit by temporarily disabling it (this is just for testing—don't leave it off permanently):

setenforce 0

If your test builds successfully after this, you need to update the SELinux context for chromedriver to mark it as a valid executable:

chcon -t bin_t /var/lib/jenkins/jobs/autocred-ui-automated-tests/workspace/autocredenciamento/chromedriver

This tells SELinux that the file is a trusted binary executable, so it won't block Jenkins from running it.

Quick Check After Fixes

Once you've run these commands, kick off a new Jenkins build. The beforeMethod failure should be gone, and your Selenium tests should be able to launch Chrome properly.

Just a quick side note: Make sure your chromedriver version matches the installed Chrome browser version on your Jenkins server—permission issues are the fix here, but version mismatches can cause other errors later on.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 07:50:21