{"record":{"id":"db2fcce866711cba","repo":"SeleniumHQ/selenium","slug":"the-driver-path-is-not-a-valid-file-output-driv","errorCode":null,"errorMessage":"The driver path is not a valid file: {output['driver_path']}","messagePattern":"The driver path is not a valid file: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/common/driver_finder.py","lineNumber":71,"sourceCode":"        if self._paths[\"driver_path\"]:\n            return self._paths\n\n        browser = self._options.capabilities[\"browserName\"]\n        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:","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/common/driver_finder.py#L53-L89","documentation":"After Selenium Manager resolves the driver, `DriverFinder` verifies the returned `driver_path` is a real file. If Selenium Manager reported a path that is not a file (corrupt install, interrupted download, manager bug), it raises `ValueError`, wrapped into `NoSuchDriverException`. This indicates Selenium Manager itself produced an unusable result.","triggerScenarios":"Selenium Manager output JSON references a driver_path that doesn't exist on disk. Corrupt Selenium Manager cache. A pinned browser-version that has no matching driver. Network failure during driver download leaving a partial/absent binary.","commonSituations":"First run in a fresh container where the manager download was interrupted. Corrupted cache under `~/.cache/selenium`. Corporate proxy truncating the download. Manager version mismatch.","solutions":["Clear the Selenium Manager cache: `rm -rf ~/.cache/selenium` and retry.","Pin a known-good browser version in options to get a stable driver match.","Provide the driver explicitly via `Service(executable_path=...)` with a verified file.","Check the chained cause on the NoSuchDriverException for Selenium Manager stderr output."],"exampleFix":"// before\n# Selenium Manager returns a non-file driver_path -> NoSuchDriverException\n// after\nrm -rf ~/.cache/selenium  # clear cache, then re-run\ndriver = webdriver.Chrome()  # manager re-downloads cleanly","handlingStrategy":"retry","validationCode":"from selenium.webdriver.common.selenium_manager import SeleniumManager\nout = SeleniumManager().binary_paths([\"--browser\", \"chrome\"])\nfrom pathlib import Path\nassert Path(out[\"driver_path\"]).is_file(), \"manager returned an invalid driver_path\"","typeGuard":"from pathlib import Path\ndef manager_driver_path_valid(out: dict) -> bool:\n    return Path(out.get(\"driver_path\", \"\")).is_file()","tryCatchPattern":"from selenium.common.exceptions import NoSuchDriverException\nimport shutil\ntry:\n    driver = webdriver.Chrome()\nexcept NoSuchDriverException as e:\n    shutil.rmtree(\"~/.cache/selenium\", ignore_errors=True)  # clear cache\n    driver = webdriver.Chrome()  # retry once","preventionTips":["Clear ~/.cache/selenium on corrupt-download symptoms.","Pin a stable browser version in options for deterministic driver matches.","Inspect the chained cause for Selenium Manager stderr."],"tags":["driver-finder","selenium-manager","setup","cache"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}