Return the absolute path of the Selenium Manager binary for this platform. `SE_MANAGER_PATH` wins when set, matching how every binding already lets users point at a manager they built or vendored themselves. Raises RuntimeError, not SystemExit, when the platform is unsupported or its
()
| 62 | |
| 63 | |
| 64 | def binary_path() -> str: |
| 65 | """Return the absolute path of the Selenium Manager binary for this platform. |
| 66 | |
| 67 | `SE_MANAGER_PATH` wins when set, matching how every binding already lets |
| 68 | users point at a manager they built or vendored themselves. |
| 69 | |
| 70 | Raises RuntimeError, not SystemExit, when the platform is unsupported or its |
| 71 | package is missing, so a binding can catch it and fall back. |
| 72 | """ |
| 73 | override = os.environ.get("SE_MANAGER_PATH") |
| 74 | if override: |
| 75 | return override |
| 76 | |
| 77 | module_name = _module_name(sys.platform, platform.machine()) |
| 78 | try: |
| 79 | platform_module = importlib.import_module(module_name) |
| 80 | except ImportError as exc: |
| 81 | pkg_name = module_name.replace("_", "-") |
| 82 | raise RuntimeError(f"Platform package {pkg_name} is not installed.\nRun: pip install {pkg_name}") from exc |
| 83 | |
| 84 | binary = platform_module.binary_path() |
| 85 | _ensure_executable(binary) |
| 86 | return binary |
| 87 | |
| 88 | |
| 89 | def _ensure_executable(binary: str) -> None: |