Selenium "'chromedriver' executable needs to be in PATH" in CI
On Selenium versions or code paths that do not invoke Selenium Manager, the binding looks up chromedriver on PATH. If no driver was installed and no Service path is set, it raises WebDriverException with this message.
What this error means
Driver creation fails with "selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH" even though Chrome is present on the runner.
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs
to be in PATH. Please see https://chromedriver.chromium.org/homeCommon causes
No ChromeDriver installed on the runner
The job installed Chrome but never installed a matching ChromeDriver, and the code does not let Selenium Manager fetch one.
A custom Service path that does not point at the binary
An explicit Service(executable_path=...) is set to a path that does not exist on the runner, so the binding falls back to a PATH lookup that fails.
How to fix it
Let Selenium Manager resolve the driver
- Upgrade Selenium to 4.6 or newer.
- Construct the driver without an executable path so Selenium Manager downloads chromedriver.
- Re-run; the driver is fetched to a managed cache, not PATH.
from selenium import webdriver
driver = webdriver.Chrome() # Selenium Manager resolves chromedriverOr install chromedriver and add it to PATH
When you manage the driver, install it in a setup step and ensure that directory is on PATH for later steps.
- uses: nanasess/setup-chromedriver@v2
- run: echo "chromedriver on PATH" && chromedriver --versionHow to prevent it
- Prefer Selenium Manager so the driver does not have to be on PATH.
- If pinning a Service path, verify the binary exists on the runner first.
- Install the driver in a dedicated setup step before the test step.