Skip to content

Commit 5a7a2ac

Browse files
committed
[py] allow bsd operating systems to use the linux binary
Log warning that it may not be supported Throw exception if the OS is not supported See: #13161
1 parent 6814b9d commit 5a7a2ac

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

py/selenium/webdriver/common/selenium_manager.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,31 @@ def get_binary() -> Path:
3939
"""Determines the path of the correct Selenium Manager binary.
4040
4141
:Returns: The Selenium Manager executable location
42+
:Raises: WebDriverException if the platform is unsupported
4243
"""
4344

4445
if (path := os.getenv("SE_MANAGER_PATH")) is not None:
4546
return Path(path)
46-
else:
47-
platform = sys.platform
4847

49-
dirs = {
50-
"darwin": "macos",
51-
"win32": "windows",
52-
"cygwin": "windows",
53-
}
48+
dirs = {
49+
"darwin": "macos",
50+
"win32": "windows",
51+
"cygwin": "windows",
52+
"linux": "linux",
53+
"freebsd": "linux",
54+
"openbsd": "linux"
55+
}
5456

55-
directory = dirs.get(platform) if dirs.get(platform) else platform
56-
file = "selenium-manager.exe" if directory == "windows" else "selenium-manager"
57+
directory = dirs.get(sys.platform)
58+
if directory is None:
59+
raise WebDriverException(f"Unsupported platform: {sys.platform}")
5760

58-
path = Path(__file__).parent.joinpath(directory, file)
61+
if sys.platform in ["freebsd", "openbsd"]:
62+
logger.warning("Selenium Manager binary may not be compatible with %s; verify settings", sys.platform)
63+
64+
file = "selenium-manager.exe" if directory == "windows" else "selenium-manager"
65+
66+
path = Path(__file__).parent.joinpath(directory, file)
5967

6068
if not path.is_file():
6169
raise WebDriverException(f"Unable to obtain working Selenium Manager binary; {path}")

0 commit comments

Comments
 (0)