SeleniumHQ/selenium · error · WebDriverException

SE_MANAGER_PATH does not point to a file: {env_path}

Error message

SE_MANAGER_PATH does not point to a file: {env_path}

What it means

Selenium Manager binary resolution checks the SE_MANAGER_PATH environment variable first; if set, the path must point to an existing file. If it is a directory, does not exist, or is not a regular file, WebDriverException is raised. This happens during driver startup before any browser launches.

Source

Thrown at py/selenium/webdriver/common/selenium_manager.py:85

        Returns:
            The Selenium Manager executable location.

        Raises:
            WebDriverException: If the platform is unsupported or Selenium Manager executable can't be found.
        """
        compiled_path = Path(__file__).parent.joinpath("selenium-manager")
        exe = sysconfig.get_config_var("EXE")
        if exe is not None:
            compiled_path = compiled_path.with_suffix(exe)

        path: Path | None = None

        if (env_path := os.getenv("SE_MANAGER_PATH")) is not None:
            logger.debug(f"Selenium Manager set by env SE_MANAGER_PATH to: {env_path}")
            path_candidate = Path(env_path)
            if not path_candidate.is_file():
                raise WebDriverException(f"SE_MANAGER_PATH does not point to a file: {env_path}")
            path = path_candidate
        elif compiled_path.is_file():
            path = compiled_path
        else:
            allowed = {
                ("darwin", "any"): "macos/selenium-manager",
                ("win32", "x86_64"): "windows/selenium-manager.exe",
                ("cygwin", "x86_64"): "windows/selenium-manager.exe",
                ("linux", "x86_64"): "linux/selenium-manager",
                ("freebsd", "x86_64"): "linux/selenium-manager",
                ("openbsd", "x86_64"): "linux/selenium-manager",
            }

            # some operating systems report x86-64 architecture as amd64/AMD64
            platform_name = sys.platform
            arch = "any" if platform_name == "darwin" else platform.machine().lower()
            arch = "x86_64" if arch == "amd64" else arch

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Ensure SE_MANAGER_PATH points to the executable file itself, not its directory.
  2. Verify the file exists and is executable: `test -f "$SE_MANAGER_PATH" && chmod +x "$SE_MANAGER_PATH"`.
  3. If unsure, unset SE_MANAGER_PATH to let Selenium use its bundled binary.
  4. Use an absolute path to avoid working-directory issues.

Example fix

# before
export SE_MANAGER_PATH=/opt/selenium/bin  # directory -> WebDriverException

# after
export SE_MANAGER_PATH=/opt/selenium/bin/selenium-manager
# or unset to use bundled binary
unset SE_MANAGER_PATH
Defensive patterns

Strategy: validation

Validate before calling

import os
from pathlib import Path
p = os.getenv('SE_MANAGER_PATH')
if p and not Path(p).is_file():
    raise FileNotFoundError(f'SE_MANAGER_PATH is not a file: {p}; point it at the executable or unset it')

Type guard

from pathlib import Path
def se_manager_path_valid() -> bool:
    p = os.getenv('SE_MANAGER_PATH')
    return p is None or Path(p).is_file()

Try / catch

from selenium.common.exceptions import WebDriverException
try:
    driver = webdriver.Chrome()
except WebDriverException as e:
    if 'SE_MANAGER_PATH' in str(e):
        os.environ.pop('SE_MANAGER_PATH', None)
        driver = webdriver.Chrome()  # retry with bundled binary

Prevention

When it happens

Trigger: Setting SE_MANAGER_PATH to a directory, a path with a typo, a non-executable file path that doesn't exist, or a path on a different mount. Then constructing a WebDriver (e.g. webdriver.Chrome()) which triggers Selenium Manager.

Common situations: Pointing SE_MANAGER_PATH at the directory containing the binary rather than the binary itself. CI environments where the path is set but the binary isn't copied. Typo in the env var. Wrong path after a container/layout change.

Related errors


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