Skip to content

Commit

Permalink
SeleniumManager python wrapper should check if architecture/platform …
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
seidnerj authored Jan 1, 2024
1 parent c284a95 commit aac6d64
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions py/selenium/webdriver/common/selenium_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import json
import logging
import os
import platform
import subprocess
import sys
from pathlib import Path
Expand Down Expand Up @@ -47,17 +48,19 @@ def get_binary() -> Path:
return Path(path)

dirs = {
"darwin": "macos",
"win32": "windows",
"cygwin": "windows",
"linux": "linux",
"freebsd": "linux",
"openbsd": "linux",
("darwin", "any"): "macos",
("win32", "any"): "windows",
("cygwin", "any"): "windows",
("linux", "x86_64"): "linux",
("freebsd", "x86_64"): "linux",
("openbsd", "x86_64"): "linux",
}

directory = dirs.get(sys.platform)
arch = platform.machine() if sys.platform in ("linux", "freebsd", "openbsd") else "any"

directory = dirs.get((sys.platform, arch))
if directory is None:
raise WebDriverException(f"Unsupported platform: {sys.platform}")
raise WebDriverException(f"Unsupported platform/architecture combination: {sys.platform}/{arch}")

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

0 comments on commit aac6d64

Please sign in to comment.