Returns a new :class:`CdpSession` connected to the specified target.
(self, target_id)
| 432 | yield session |
| 433 | |
| 434 | async def connect_session(self, target_id) -> "CdpSession": |
| 435 | """Returns a new :class:`CdpSession` connected to the specified target.""" |
| 436 | global devtools |
| 437 | if devtools is None: |
| 438 | raise RuntimeError("CDP devtools module not loaded. Call import_devtools() first.") |
| 439 | session_id = await self.execute(devtools.target.attach_to_target(target_id, True)) |
| 440 | session = CdpSession(self.ws, session_id, target_id) |
| 441 | self.sessions[session_id] = session |
| 442 | return session |
| 443 | |
| 444 | async def _reader_task(self): |
| 445 | """Runs in the background and handles incoming messages. |
no test coverage detected