100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Testing

Installing Selenium and Browser Drivers

A practical walkthrough of installing the Selenium library and setting up matching browser drivers, including Selenium Manager's automatic driver handling.

FoundationsBeginner7 min readJul 10, 2026
Analogies

Installing Selenium and Browser Drivers

Getting a Selenium test running requires two separate installs: the Selenium client library for your programming language, and a driver executable matching the browser you want to automate. Beginners often install the library and stop there, then hit a confusing 'unable to find driver' or 'SessionNotCreatedException' the moment they try to launch a browser, because the two pieces are installed and versioned independently.

🏏

Cricket analogy: Needing both the library and the driver is like a bowler needing both a valid ball and the umpire's clearance to start an over — having just one without the other means play simply cannot begin.

Installing the Selenium Library

In Python, installing Selenium is a single command: pip install selenium. In a Java Maven project, you add the org.seleniumhq.selenium:selenium-java dependency to your pom.xml; in a JavaScript/Node project, npm install selenium-webdriver. As of Selenium 4.6, no separate driver download step is strictly required for the major browsers, because the library ships with Selenium Manager, which detects your installed browser and fetches a matching driver automatically the first time you run a test.

🏏

Cricket analogy: A single pip install command setting everything up is like a franchise's kit sponsor delivering the entire team's gear in one shipment rather than each player individually sourcing their own bat, pads, and gloves.

Getting the Right Browser Driver

Before Selenium 4.6, you had to manually download the correct driver binary for your OS and browser version from each vendor's site (ChromeDriver from Chrome for Testing, geckodriver from Mozilla's GitHub releases) and either place it on your system PATH or point to it explicitly with something like Service(executable_path='./chromedriver'). Selenium Manager removed most of that friction: it ships inside the Selenium library itself, checks your installed browser's version, downloads a matching driver into a local cache directory if one isn't already there, and wires it up transparently before your test even starts.

🏏

Cricket analogy: Selenium Manager auto-fetching the right driver version is like a groundskeeper automatically preparing the correct pitch length and bounce for whichever format — Test, ODI, or T20 — is scheduled that day, without the captain having to specify it.

bash
pip install selenium

python -c "
from selenium import webdriver
driver = webdriver.Chrome()   # Selenium Manager resolves the matching ChromeDriver automatically
print(driver.capabilities['browserVersion'])
driver.quit()
"

Selenium Manager caches downloaded drivers under a local directory (~/.cache/selenium on Linux/macOS, %LOCALAPPDATA%\selenium on Windows), so subsequent test runs reuse the cached driver instead of re-downloading it every time.

Putting the Driver on PATH

If you do install a driver manually — common in CI environments where you want a pinned, reproducible driver version rather than whatever Selenium Manager resolves at runtime — the executable must either live in a directory listed in your system's PATH environment variable, or you pass its exact location to the Service object in your test code. A driver that exists on disk but isn't discoverable through either mechanism produces the same 'unable to locate executable' error as if it were never installed at all.

🏏

Cricket analogy: A driver that's downloaded but not on PATH is like a substitute fielder standing in the dugout instead of registered on the official team sheet — physically present, but the umpire's system doesn't recognize them as eligible to take the field.

On macOS, a manually downloaded driver binary is often blocked by Gatekeeper with an 'unidentified developer' warning the first time it runs. You typically need to clear this via System Settings > Privacy & Security, or run xattr -d com.apple.quarantine ./chromedriver, before Selenium can execute it.

  • Installing Selenium requires both the client library (pip/npm/Maven) and a browser driver — they are separate pieces.
  • Since Selenium 4.6, Selenium Manager automatically detects your browser and downloads a matching driver.
  • Selenium Manager caches drivers locally so repeat runs don't re-download them.
  • Manual driver installs remain common in CI for pinning a reproducible driver version.
  • A driver must be on PATH or explicitly referenced via a Service object to be discoverable.
  • macOS Gatekeeper can block a manually downloaded driver until quarantine is cleared.

Practice what you learned

Was this page helpful?

Topics covered

#Testing#SeleniumStudyNotes#TestingQA#InstallingSeleniumAndBrowserDrivers#Installing#Selenium#Browser#Drivers#StudyNotes#SkillVeris