Skip to content

Commit aac6d64

Browse files
authored
SeleniumManager python wrapper should check if architecture/platform combination is supported (#13381)
* SeleniumManager's get_binary() should check if architecture/platform combination is supported (and not only if the platform is supported). * fix linting error (Imports are incorrectly sorted and/or formatted)
1 parent c284a95 commit aac6d64

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

py/selenium/webdriver/common/selenium_manager.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import json
1818
import logging
1919
import os
20+
import platform
2021
import subprocess
2122
import sys
2223
from pathlib import Path
@@ -47,17 +48,19 @@ def get_binary() -> Path:
4748
return Path(path)
4849

4950
dirs = {
50-
"darwin": "macos",
51-
"win32": "windows",
52-
"cygwin": "windows",
53-
"linux": "linux",
54-
"freebsd": "linux",
55-
"openbsd": "linux",
51+
("darwin", "any"): "macos",
52+
("win32", "any"): "windows",
53+
("cygwin", "any"): "windows",
54+
("linux", "x86_64"): "linux",
55+
("freebsd", "x86_64"): "linux",
56+
("openbsd", "x86_64"): "linux",
5657
}
5758

58-
directory = dirs.get(sys.platform)
59+
arch = platform.machine() if sys.platform in ("linux", "freebsd", "openbsd") else "any"
60+
61+
directory = dirs.get((sys.platform, arch))
5962
if directory is None:
60-
raise WebDriverException(f"Unsupported platform: {sys.platform}")
63+
raise WebDriverException(f"Unsupported platform/architecture combination: {sys.platform}/{arch}")
6164

6265
if sys.platform in ["freebsd", "openbsd"]:
6366
logger.warning("Selenium Manager binary may not be compatible with %s; verify settings", sys.platform)

0 commit comments

Comments
 (0)