ScreenshotNeo

BlogHow-to

Selenium Manager: How to Set Up WebDriver Automatically

Set up Selenium WebDriver without manually downloading a driver. Learn how Selenium Manager resolves drivers, how to configure it, and how to fix common failures.

By the ScreenshotNeo team4 October 20269 min read

Direct answer: For a normal local Selenium WebDriver session, install or update the Selenium language binding and create the browser driver through its usual API. Selenium Manager is bundled with Selenium releases from 4.6 onward. When your binding has not been given a driver explicitly, it can invoke Selenium Manager to detect the browser, resolve a compatible driver, download it when needed, and cache it. You do not need a separate driver manager or a manual ChromeDriver download for this basic setup.

Selenium Manager manages drivers automatically as a fallback. If your code or environment already supplies a driver path, that existing setup takes precedence. Driver management also does not mean that every browser is installed automatically: browser downloads are a separate capability with browser-specific Selenium release requirements.

1. Install Selenium and start a session

Use a current Selenium binding and the standard browser driver API. The examples below let Selenium Manager resolve the driver; none provides a driver executable path.

Python

python -m pip install --upgrade selenium
from selenium import webdriver

# Selenium Manager resolves the driver if one was not otherwise provided.
driver = webdriver.Chrome()
try:
    driver.get("https://example.com")
    print(driver.title)
finally:
    driver.quit()

Java

Add the Selenium Java binding to your project using its normal dependency mechanism, then use the ordinary driver constructor:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Main {
    public static void main(String[] args) {
        WebDriver driver = new ChromeDriver();
        try {
            driver.get("https://example.com");
            System.out.println(driver.getTitle());
        } finally {
            driver.quit();
        }
    }
}

JavaScript (Node.js)

Install or update the official Selenium WebDriver package with your package manager. Selenium Manager is used by Selenium bindings; ensure the binding version in use bundles or supports it.

npm install selenium-webdriver
const { Builder } = require('selenium-webdriver');

(async () => {
  const driver = await new Builder().forBrowser('chrome').build();
  try {
    await driver.get('https://example.com');
    console.log(await driver.getTitle());
  } finally {
    await driver.quit();
  }
})();

C#

Install or update the Selenium WebDriver NuGet package, then create the driver normally:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

IWebDriver driver = new ChromeDriver();
try
{
    driver.Navigate().GoToUrl("https://example.com");
    Console.WriteLine(driver.Title);
}
finally
{
    driver.Quit();
}

Ruby

Install or update the selenium-webdriver gem:

gem install selenium-webdriver
require "selenium-webdriver"

driver = Selenium::WebDriver.for :chrome
begin
  driver.navigate.to "https://example.com"
  puts driver.title
ensure
  driver.quit
end

Use the same pattern for other supported browsers: create the driver with the binding’s normal API and do not set an executable path unless you intentionally manage the driver yourself. Keep the binding reasonably current, since Selenium Manager behavior and browser compatibility depend on the Selenium release.

2. What Selenium Manager does

When a Selenium binding needs a driver and no driver has been supplied, Selenium Manager can:

  1. Identify the requested browser and discover its installed version.
  2. Resolve a compatible driver version using browser vendor metadata.
  3. Download the driver if it is not already available locally.
  4. Cache the assets for later sessions.

The default cache directory is ~/.cache/selenium. The metadata time-to-live (TTL) defaults to 3600 seconds, or one hour. Selenium Manager also removes browser or driver version directories that have not been used for more than 30 days. A later run may refresh metadata or retrieve an asset that is no longer cached.

Driver management is distinct from browser management. Selenium Manager browser downloads were added at different milestones: Chrome from Selenium 4.11.0, Firefox from 4.12.0, and Edge from 4.14.0. Windows Edge installation can require administrator permissions. Do not assume a missing browser will be installed just because driver management works.

3. Check resolution with Selenium Manager directly

Application code should normally use the binding API, but the Selenium Manager command-line interface can help diagnose setup. Run:

selenium-manager --browser chrome --debug

Debug output can show browser detection, version resolution, downloads, and resulting paths. If the command is unavailable, that does not necessarily mean your Selenium binding cannot invoke its bundled Manager; first verify the binding version and its installation.

4. Configure Selenium Manager

Most local sessions need no configuration. For managed environments, settings can be supplied as command-line options, a se-config.toml file, or SE_-prefixed environment variables. The documented precedence is command-line options, then the config file, then environment variables.

Need Setting or approach When to use it
Use a proxy --proxy or SE_PROXY; browser proxy options are another layer When vendor metadata or driver downloads must pass through a corporate proxy.
Change the cache directory --cache-path or SE_CACHE_PATH When the default home-directory cache is unsuitable or storage must be managed explicitly.
Prevent network requests SE_OFFLINE=true or the corresponding offline option For an air-gapped run where required browser and driver assets are already present locally.
Pin versions Browser-version and driver-version options, config keys, or environment equivalents When reproducibility requires a deliberate browser/driver pairing.
Use explicit installation paths Browser or driver path options When system package managers or a managed image provide assets at known locations.
Use a custom Manager binary SE_MANAGER_PATH (available from Selenium 4.13.0) When the default bundled binary is incompatible with the platform or architecture.
Change metadata refresh behavior Configure the metadata TTL; default is 3600 seconds When metadata refresh frequency needs to match network or reproducibility policy. A TTL of zero disables TTL behavior.

Configuration names and supported options can vary by Selenium Manager release. Check the official Selenium Manager documentation for the exact option spelling supported by the version you deploy. Avoid placing credentials in committed config files or logs.

Offline and restricted-network operation

Offline mode disables network requests and downloads. It cannot satisfy a first run that lacks the required local assets. For an air-gapped deployment, provision the browser and compatible driver ahead of time, point Selenium at the correct locations when necessary, and verify that the cache or packaged assets remain available to the runtime user.

Behind a firewall, configure the proxy where appropriate and confirm that the environment can reach both the metadata and download endpoints used by the browser vendor. A proxy setting does not bypass a firewall rule that blocks those destinations.

Version pinning and reproducibility

Automatic resolution is convenient for an ordinary developer machine. For repeatable CI or release runs, pinning a browser and driver can make the intended pairing explicit. Keep the browser, driver, Selenium binding, and platform image aligned. A pinned driver can become incompatible if the browser is upgraded independently.

5. Selenium Grid setup

For Grid, the Selenium getting-started guidance shows starting the relevant node with Selenium Manager enabled:

java -jar selenium-server-<version>.jar node --selenium-manager true

Use the exact server version and command structure for your Grid deployment. Confirm that the node can access required browser metadata and downloads, or pre-provision assets and configure paths for restricted or offline environments. See the Selenium Grid getting-started guide.

6. Common errors and fixes

Symptom Likely cause What to do
“Unable to locate driver” or driver executable not found Old Selenium binding, explicit configuration pointing to a missing path, or a Manager binary that cannot run. Update the binding; remove an unintended stale driver path; inspect Manager output with --debug. If the platform needs it, configure a valid browser/driver path or a compatible Manager binary.
Manager cannot download or resolve a driver Blocked network, proxy not configured, DNS/TLS restrictions, or vendor metadata unavailable. Check proxy and outbound access to metadata and download endpoints. In controlled environments, provision compatible assets and use explicit paths or an already-populated cache.
Offline session fails on a fresh machine Offline mode prevents fetching missing assets. Provision the required browser and driver before the offline run, and verify their paths and permissions.
Browser and driver versions do not work together A pinned or package-managed driver is incompatible with the installed browser, or the browser changed after pinning. Align the browser and driver versions. Remove unintended explicit paths if you want Manager fallback to resolve the driver.
Browser download or installation is denied The environment prohibits downloads or installation requires elevated permissions; Windows Edge installation may require administrator permissions. Use an approved preinstalled browser, obtain the required permissions, or provision the browser through the system image and configure its location.
Custom browser installed by Linux package manager is not detected as expected Distribution-specific locations or packaging can differ from Manager’s discovery assumptions. Set explicit browser and, if needed, driver locations; verify the exact paths in debug output.
Session starts, then commands time out or target elements are missing Page synchronization, navigation, or application timing problems rather than driver resolution. Wait for the relevant page state or element condition, and inspect the application’s loading behavior. Selenium troubleshooting guidance identifies poor synchronization as a common source of Selenium errors.
Cache is missing an older driver Unused version directories may be removed after more than 30 days. Allow Manager to resolve and download the needed version again, or provision and pin the required asset for an offline workflow.

For general session and browser-control issues, use the Selenium Project’s troubleshooting guide. A missing driver is only one possible cause of a failed automation run.

7. Performance, reliability, and cost

  • First run: Driver discovery may require network access and a download, so the first session can take longer than later sessions.
  • Later runs: Cached assets avoid repeating downloads while they remain available and compatible.
  • Reliability: A network failure, vendor metadata change, browser upgrade, or restrictive execution environment can affect resolution. Pin versions or pre-provision assets when your environment requires reproducibility or offline operation.
  • Cache lifecycle: Metadata refreshes according to its TTL, one hour by default; unused browser or driver version directories can be removed after more than 30 days.
  • Cost: Selenium Manager is included with Selenium. The main operational costs are download time, network access, storage, and maintaining compatible browser/driver versions; there is no separate Selenium Manager service purchase required for the basic setup.

8. DIY Selenium or a screenshot API?

Use Selenium when you need browser interaction, application testing, or control over a browser session. If your task is simply to obtain a page screenshot or PDF, a screenshot API can avoid maintaining browser and driver setup for that capture workflow. ScreenshotNeo is a website screenshot API and MCP server from Yorker Media.

Or skip the browser setup

Make one GET request with a URL. See the ScreenshotNeo API documentation for options and response details.

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
const bytes = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', bytes);

ScreenshotNeo accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan.

Sign up free for 1,000 screenshots a month with no card.

FAQ

Do I need to install Selenium Manager separately?

No. It is bundled with Selenium releases from 4.6 onward and is normally invoked by the binding when a driver has not already been supplied.

Will Selenium Manager install Chrome, Firefox, or Edge for me?

Browser downloads are separate from driver management and depend on Selenium release support. The documented milestones are Chrome 4.11.0, Firefox 4.12.0, and Edge 4.14.0; Windows Edge installation may need administrator permissions.

Where does Selenium Manager store its downloads?

The default cache is ~/.cache/selenium. You can change it with the cache-path setting.

Can Selenium Manager work without internet access?

Yes, when all required assets are already available locally. Offline mode disables requests and downloads, so it cannot fetch a missing driver or browser.

Should I use Selenium Manager or manually manage ChromeDriver?

For a standard local session, start with Selenium Manager’s default fallback. Keep explicit paths or pinned versions when your platform policy or reproducibility requirements call for them.

Sources