Skip to content

Commit

Permalink
py: Ensure DRIVER_PATH_ENV_KEY defaults to string
Browse files Browse the repository at this point in the history
Follow up to PR #14528, to avoid `os.getenv` raising `TypeError`
in `env_path` when `driver_path_env_key` is not passed to `Service`
constructor.
  • Loading branch information
lauromoura committed Dec 6, 2024
1 parent 7a93ff7 commit 84f41bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion py/selenium/webdriver/common/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Service(ABC):
:param port: Port for the service to run on, defaults to 0 where the operating system will decide.
:param log_output: (Optional) int representation of STDOUT/DEVNULL, any IO instance or String path to file.
:param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`.
:param driver_path_env_key: (Optional) Environment variable to use to get the path to the driver executable.
"""

def __init__(
Expand All @@ -75,7 +76,7 @@ def __init__(
self.popen_kw = kwargs.pop("popen_kw", {})
self.creation_flags = self.popen_kw.pop("creation_flags", 0)
self.env = env or os.environ
self.DRIVER_PATH_ENV_KEY = driver_path_env_key
self.DRIVER_PATH_ENV_KEY = driver_path_env_key or ""
self._path = self.env_path() or executable_path

@property
Expand Down

0 comments on commit 84f41bd

Please sign in to comment.