SeleniumHQ/selenium · error · anyhow::Error

Browser path does not exist: {}

Error message

Browser path does not exist: {}

What it means

Thrown in general_discover_browser_version() when an explicit browser path was configured (non-empty) but does not exist on disk. Selenium Manager first calls set_fallback_driver_from_cache(false), then returns the error. The placeholder is the configured path.

Source

Thrown at rust/src/lib.rs:1254

        }

        Ok(Some(browser_version))
    }

    fn general_discover_browser_version(
        &mut self,
        reg_key: &'static str,
        reg_version_arg: &'static str,
        cmd_version_arg: &str,
    ) -> Result<Option<String>, Error> {
        let mut browser_path = self.get_browser_path().to_string();
        if browser_path.is_empty() {
            if let Some(path) = self.detect_browser_path() {
                browser_path = path_to_string(&path);
            }
        } else if !Path::new(&browser_path).exists() {
            self.set_fallback_driver_from_cache(false);
            return Err(anyhow!(format_one_arg(
                "Browser path does not exist: {}",
                &browser_path,
            )));
        }
        let escaped_browser_path = self.get_escaped_path(browser_path.to_string());

        let mut commands = Vec::new();
        if WINDOWS.is(self.get_os()) {
            if !escaped_browser_path.is_empty() && !self.is_webview2() {
                return Ok(get_win_file_version(&escaped_browser_path));
            }
            if !self.is_browser_version_unstable() {
                let reg_command = Command::new(
                    "REG",
                    vec![
                        String::from("QUERY"),
                        reg_key.to_string(),
                        String::from("/v"),

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Verify the path with ls/Get-Item and copy the absolute path.
  2. Leave --browser-path unset so Selenium Manager auto-detects the browser.
  3. On Windows, use double backslashes or forward slashes and quote paths containing spaces.
  4. Ensure the browser binary is actually installed at that location in the runtime environment (e.g. the Docker image).

Example fix

# before
selenium-manager --browser chrome --browser-path /usr/bim/google-chrome   # typo
# after
selenium-manager --browser chrome --browser-path /usr/bin/google-chrome
Defensive patterns

Strategy: validation

Validate before calling

use std::path::Path;
let browser_path = config.browser_path();
if !browser_path.is_empty() && !Path::new(&browser_path).exists() {
    return Err(anyhow!("configured browser path missing: {browser_path}"));
}
manager.discover_browser_version()

Prevention

When it happens

Trigger: get_browser_path() returns a non-empty string and Path::new(&browser_path).exists() is false (lib.rs:1252), e.g. when --browser-path points to a missing file.

Common situations: Typo in the path; the browser was uninstalled or moved; a path valid on the dev machine but wrong inside a container; Windows path quoting issues; relative path resolved against an unexpected cwd.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/ef3dcd0201c6ec8b. Report an issue: GitHub.