MCPcopy Create free account
hub / github.com/microsoft/playwright-python / connect

Method connect

playwright/_impl/_transport.py:104–135  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

102 await self._stopped_future
103
104 async def connect(self) -> None:
105 self._stopped_future: asyncio.Future = asyncio.Future()
106
107 try:
108 # For pyinstaller and Nuitka
109 env = get_driver_env()
110 if getattr(sys, "frozen", False) or globals().get("__compiled__"):
111 env.setdefault("PLAYWRIGHT_BROWSERS_PATH", "0")
112
113 startupinfo = None
114 if sys.platform == "win32":
115 startupinfo = subprocess.STARTUPINFO()
116 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
117 startupinfo.wShowWindow = subprocess.SW_HIDE
118
119 executable_path, entrypoint_path = compute_driver_executable()
120 self._proc = await asyncio.create_subprocess_exec(
121 executable_path,
122 entrypoint_path,
123 "run-driver",
124 stdin=asyncio.subprocess.PIPE,
125 stdout=asyncio.subprocess.PIPE,
126 stderr=_get_stderr_fileno(),
127 limit=32768,
128 env=env,
129 startupinfo=startupinfo,
130 )
131 except Exception as exc:
132 self.on_error_future.set_exception(exc)
133 raise exc
134
135 self._output = self._proc.stdin
136
137 async def run(self) -> None:
138 assert self._proc.stdout

Callers

nothing calls this directly

Calls 4

get_driver_envFunction · 0.90
_get_stderr_filenoFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected