diff --git a/playwright/_impl/_transport.py b/playwright/_impl/_transport.py index 5565c62b7..3c9f96be0 100644 --- a/playwright/_impl/_transport.py +++ b/playwright/_impl/_transport.py @@ -16,6 +16,7 @@ import io import json import os +import subprocess import sys from abc import ABC, abstractmethod from pathlib import Path @@ -113,6 +114,12 @@ async def connect(self) -> None: if getattr(sys, "frozen", False): env.setdefault("PLAYWRIGHT_BROWSERS_PATH", "0") + startupinfo = None + if sys.platform == "win32": + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + startupinfo.wShowWindow = subprocess.SW_HIDE + self._proc = await asyncio.create_subprocess_exec( str(self._driver_executable), "run-driver", @@ -121,6 +128,7 @@ async def connect(self) -> None: stderr=_get_stderr_fileno(), limit=32768, env=env, + startupinfo=startupinfo, ) except Exception as exc: self.on_error_future.set_exception(exc)