MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / binary_path

Function binary_path

py/selenium-manager/selenium_manager/__init__.py:64–86  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

62
63
64def 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
89def _ensure_executable(binary: str) -> None:

Calls 4

_module_nameFunction · 0.85
_ensure_executableFunction · 0.85
getMethod · 0.65
binary_pathMethod · 0.45