Skip to content
Latchkey

geckodriver "not found in PATH" / needs to be in PATH in CI

Selenium could not find geckodriver, the binary that bridges WebDriver to Firefox. As with ChromeDriver, either it was never installed on the runner or it lives in a directory not on PATH for the test step.

What this error means

The Firefox session fails to start with "'geckodriver' executable needs to be in PATH" or "Unable to obtain driver for firefox" when the binary is absent.

geckodriver
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable
needs to be in PATH.

Common causes

geckodriver is not installed

No step downloaded the Firefox driver, so Selenium has nothing to launch for Firefox.

The driver is installed off PATH

The binary is in a cache or project directory the test step's PATH does not include.

How to fix it

Let Selenium Manager resolve it, or install the driver

Selenium 4.6+ downloads geckodriver automatically; otherwise install it and add it to PATH.

.github/workflows/ci.yml
- uses: browser-actions/setup-firefox@v1
- uses: browser-actions/setup-geckodriver@v2

Pass the driver path via a Service

Point the Firefox client at the binary directly so PATH lookup is not needed.

Python
from selenium.webdriver.firefox.service import Service
driver = webdriver.Firefox(service=Service('/usr/local/bin/geckodriver'))

How to prevent it

  • Prefer Selenium 4.6+ so geckodriver is resolved automatically.
  • If installing manually, put the driver in a directory on PATH.
  • Keep Firefox and geckodriver installed by actions that stay compatible.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →