{"record":{"id":"787d519b2ea278d4","repo":"SeleniumHQ/selenium","slug":"the-browser-path-is-not-a-valid-file-output-bro","errorCode":null,"errorMessage":"The browser path is not a valid file: {output['browser_path']}","messagePattern":"The browser path is not a valid file: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/driver_finder.py","lineNumber":75,"sourceCode":"        try:\n            path = self._service.path\n            if path:\n                logger.debug(\n                    \"Skipping Selenium Manager; path to %s driver specified in Service class: %s\", browser, path\n                )\n                if not Path(path).is_file():\n                    raise ValueError(f\"The path is not a valid file: {path}\")\n                self._paths[\"driver_path\"] = path\n            else:\n                output = SeleniumManager().binary_paths(self._to_args())\n                if Path(output[\"driver_path\"]).is_file():\n                    self._paths[\"driver_path\"] = output[\"driver_path\"]\n                else:\n                    raise ValueError(f\"The driver path is not a valid file: {output['driver_path']}\")\n                if Path(output[\"browser_path\"]).is_file():\n                    self._paths[\"browser_path\"] = output[\"browser_path\"]\n                else:\n                    raise ValueError(f\"The browser path is not a valid file: {output['browser_path']}\")\n        except Exception as err:\n            msg = f\"Unable to obtain driver for {browser}\"\n            raise NoSuchDriverException(msg) from err\n        return self._paths\n\n    def _to_args(self) -> list:\n        args = [\"--browser\", self._options.capabilities[\"browserName\"]]\n\n        if self._options.browser_version:\n            args.append(\"--browser-version\")\n            args.append(str(self._options.browser_version))\n\n        binary_location = getattr(self._options, \"binary_location\", None)\n        if binary_location:\n            args.append(\"--browser-path\")\n            args.append(str(binary_location))\n\n        proxy = self._options.proxy","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/driver_finder.py#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\n# browser_path not a file -> NoSuchDriverException on headless CI\n// after\n# install the browser first, or point at it explicitly\noptions.binary_location = \"/usr/bin/google-chrome\"\ndriver = webdriver.Chrome(options=options)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nbinary = \"/usr/bin/google-chrome\"\nif not Path(binary).is_file():\n    raise FileNotFoundError(f\"browser not installed at {binary}; install it first\")\noptions.binary_location = binary","typeGuard":"from pathlib import Path\ndef browser_binary_exists(path) -> bool:\n    return Path(path).is_file()","tryCatchPattern":"from selenium.common.exceptions import NoSuchDriverException\ntry:\n    driver = webdriver.Chrome()\nexcept NoSuchDriverException:\n    options.binary_location = \"/usr/bin/google-chrome\"  # explicit fallback\n    driver = webdriver.Chrome(options=options)","preventionTips":["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."],"tags":["driver-finder","selenium-manager","browser-path","setup"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}