Skip to content

Selenium: chromedriver executable needs to be in PATH?

Selenium cannot start Chrome unless it can locate a compatible chromedriver binary.

OUTPUT FORMATSHTMLJSONMarkdown

When the driver is missing from your system PATH, the session fails before any page loads and you see a WebDriverException naming the missing executable. The quickest durable fix is to let the webdriver-manager package fetch and register a matching driver for you instead of hand-editing environment variables.

What the error looks like

The failure surfaces as a WebDriverException raised by Selenium before the browser opens. The message names the chromedriver executable and points to the Chrome driver download page. Reproduce it by launching webdriver.Chrome() on a machine where chromedriver is not on PATH.

The webdriver-manager fix

webdriver-manager checks whether a valid chromedriver is available on PATH. If none is found, it downloads one automatically. Install it with pip, then pass the manager into webdriver.Chrome through a Service object. The manager resolves the driver path at runtime, so you do not hard-code a filesystem location.

Why the first run is slower

The initial launch can take a second or two because the chromedriver binary has to be downloaded. Later runs reuse the cached driver and start noticeably faster.

Decision checklist

Use this to choose between the two common approaches:

  • If you want zero manual PATH edits and automatic driver downloads: install webdriver-manager and wire it through Service.
  • If you manage drivers yourself: place chromedriver on PATH and keep its version aligned with your installed Chrome.
  • If the error persists after installing webdriver-manager: confirm the package is installed in the same Python environment that runs Selenium.
  • If the browser still fails to start: distinguish a missing binary from a version mismatch; a mismatch usually produces a different startup error.

Field map of the Python fix

The snippet has three moving parts:

  • Import: pulls webdriver, Service, and ChromeDriverManager.
  • Service: wraps the resolved driver path so webdriver.Chrome knows where to find it.
  • ChromeDriverManager().install(): returns the driver path, downloading it if needed.

The driver.get() call then opens the target URL once the session is established.

Frequently asked questions

Do I still need to add chromedriver to PATH manually?

Not if you use webdriver-manager. It ensures a valid chromedriver is available and downloads one when it is missing, so manual PATH edits are optional.

Why does the first run take longer?

The initial run downloads the chromedriver binary. Subsequent runs reuse the cached driver and are faster.

What is the difference between a missing driver and a version mismatch?

A missing driver produces the WebDriverException about the executable not being on PATH. A version mismatch occurs when a driver is found but does not match the installed Chrome version; the error text differs and usually mentions a version or session creation failure.