Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions py/selenium/webdriver/common/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ def __init__(
driver_path_env_key: Optional[str] = None,
**kwargs,
) -> None:
self.log_output: Optional[Union[int, IOBase]]
if isinstance(log_output, str):
self.log_output = cast(IOBase, open(log_output, "a+", encoding="utf-8"))
elif log_output == subprocess.STDOUT:
self.log_output = cast(Optional[Union[int, IOBase]], None)
self.log_output = None
elif log_output is None or log_output == subprocess.DEVNULL:
self.log_output = cast(Optional[Union[int, IOBase]], subprocess.DEVNULL)
self.log_output = subprocess.DEVNULL
else:
self.log_output = log_output
self.log_output = cast(Union[int, IOBase], log_output)

self.port = port or utils.free_port()
# Default value for every python subprocess: subprocess.Popen(..., creationflags=0)
Expand Down Expand Up @@ -208,9 +209,9 @@ def _start_process(self, path: str) -> None:
try:
start_info = None
if system() == "Windows":
start_info = subprocess.STARTUPINFO() # type: ignore[attr-defined]
start_info.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW # type: ignore[attr-defined]
start_info.wShowWindow = subprocess.SW_HIDE # type: ignore[attr-defined]
start_info = subprocess.STARTUPINFO()
start_info.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
start_info.wShowWindow = subprocess.SW_HIDE

self.process = subprocess.Popen(
cmd,
Expand Down