Skip to content

Commit 84f41bd

Browse files
committed
py: Ensure DRIVER_PATH_ENV_KEY defaults to string
Follow up to PR SeleniumHQ#14528, to avoid `os.getenv` raising `TypeError` in `env_path` when `driver_path_env_key` is not passed to `Service` constructor.
1 parent 7a93ff7 commit 84f41bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/selenium/webdriver/common/service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class Service(ABC):
5050
:param port: Port for the service to run on, defaults to 0 where the operating system will decide.
5151
:param log_output: (Optional) int representation of STDOUT/DEVNULL, any IO instance or String path to file.
5252
:param env: (Optional) Mapping of environment variables for the new process, defaults to `os.environ`.
53+
:param driver_path_env_key: (Optional) Environment variable to use to get the path to the driver executable.
5354
"""
5455

5556
def __init__(
@@ -75,7 +76,7 @@ def __init__(
7576
self.popen_kw = kwargs.pop("popen_kw", {})
7677
self.creation_flags = self.popen_kw.pop("creation_flags", 0)
7778
self.env = env or os.environ
78-
self.DRIVER_PATH_ENV_KEY = driver_path_env_key
79+
self.DRIVER_PATH_ENV_KEY = driver_path_env_key or ""
7980
self._path = self.env_path() or executable_path
8081

8182
@property

0 commit comments

Comments
 (0)