Skip to content

Commit

Permalink
[py] do not check sys.platform if setting environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Sep 18, 2023
1 parent 58d415f commit 0755e68
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions py/selenium/webdriver/common/selenium_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,23 @@ def get_binary() -> Path:
:Returns: The Selenium Manager executable location
"""
directory = "linux"

file = "selenium-manager"
if os.getenv("SE_MANAGER_PATH"):
directory = os.getenv("SE_MANAGER_PATH")
file = ""
if sys.platform == "darwin":
directory = "macos"
elif sys.platform in ("win32", "cygwin"):
directory = "windows"
file = "selenium-manager.exe"

path = Path(__file__).parent.joinpath(directory, file)
path = os.getenv("SE_MANAGER_PATH")
else:
platform = sys.platform

dirs = {
"darwin": "macos",
"win32": "windows",
"cygwin": "windows",
}

directory = dirs.get(platform) if dirs.get(platform) else platform
file = "selenium-manager.exe" if directory == "windows" else "selenium-manager"

path = Path(__file__).parent.joinpath(directory, file)

if not path.is_file() and os.environ["CONDA_PREFIX"]:
# conda has a separate package selenium-manager, installs in bin
Expand Down

0 comments on commit 0755e68

Please sign in to comment.