SeleniumHQ/selenium · error · ValueError
The browser path is not a valid file: {output['browser_path'
Error message
The browser path is not a valid file: {output['browser_path']} What it means
After Selenium Manager resolves the browser location, `DriverFinder` verifies the returned `browser_path` is a real file. If it is not, it raises `ValueError`, wrapped into `NoSuchDriverException`. This means Selenium Manager could not locate a usable browser binary even though it returned a path string.
Source
Thrown at py/selenium/webdriver/common/driver_finder.py:75
try:
path = self._service.path
if path:
logger.debug(
"Skipping Selenium Manager; path to %s driver specified in Service class: %s", browser, path
)
if not Path(path).is_file():
raise ValueError(f"The path is not a valid file: {path}")
self._paths["driver_path"] = path
else:
output = SeleniumManager().binary_paths(self._to_args())
if Path(output["driver_path"]).is_file():
self._paths["driver_path"] = output["driver_path"]
else:
raise ValueError(f"The driver path is not a valid file: {output['driver_path']}")
if Path(output["browser_path"]).is_file():
self._paths["browser_path"] = output["browser_path"]
else:
raise ValueError(f"The browser path is not a valid file: {output['browser_path']}")
except Exception as err:
msg = f"Unable to obtain driver for {browser}"
raise NoSuchDriverException(msg) from err
return self._paths
def _to_args(self) -> list:
args = ["--browser", self._options.capabilities["browserName"]]
if self._options.browser_version:
args.append("--browser-version")
args.append(str(self._options.browser_version))
binary_location = getattr(self._options, "binary_location", None)
if binary_location:
args.append("--browser-path")
args.append(str(binary_location))
proxy = self._options.proxyView on GitHub (pinned to aa36b38e69)
Solutions
- Install the browser in the environment (e.g. `apt install google-chrome-stable`).
- Set `options.binary_location` explicitly to the real browser path.
- Clear the Selenium Manager cache so it re-detects: `rm -rf ~/.cache/selenium`.
- Use a Docker image that ships the browser (e.g. selenium/standalone-chrome).
Example fix
// before # browser_path not a file -> NoSuchDriverException on headless CI // after # install the browser first, or point at it explicitly options.binary_location = "/usr/bin/google-chrome" driver = webdriver.Chrome(options=options)
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
binary = "/usr/bin/google-chrome"
if not Path(binary).is_file():
raise FileNotFoundError(f"browser not installed at {binary}; install it first")
options.binary_location = binary Type guard
from pathlib import Path
def browser_binary_exists(path) -> bool:
return Path(path).is_file() Try / catch
from selenium.common.exceptions import NoSuchDriverException
try:
driver = webdriver.Chrome()
except NoSuchDriverException:
options.binary_location = "/usr/bin/google-chrome" # explicit fallback
driver = webdriver.Chrome(options=options) Prevention
- Install the browser in CI/Docker images.
- Set options.binary_location explicitly for non-standard installs.
- Use official selenium/* Docker images that bundle the browser.
When it happens
Trigger: Selenium Manager reports a browser_path that does not exist. Browser was uninstalled/moved after manager cached its location. A browser version pinned via options that is not installed. Headless-only image without the GUI browser binary.
Common situations: Browser uninstalled since last run. CI image without Chrome/Edge installed and Selenium Manager cannot install it. Snap/Flatpak installs in non-standard paths. Mismatched architecture (arm64 vs amd64) browser package.
Related errors
- The driver path is not a valid file: {output['driver_path']}
- Unable to obtain driver for {browser}
- The path is not a valid file: {path}
- Browser path does not exist: {}
- Unable to obtain browser driver. For more informatio
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/787d519b2ea278d4.
Report an issue: GitHub.