Context manager opens a session and enables the "simple" style of calling CDP APIs. For example, inside a session context, you can call ``await dom.get_document()`` and it will execute on the current session automatically.
(self, target_id)
| 421 | |
| 422 | @asynccontextmanager |
| 423 | async def open_session(self, target_id) -> AsyncIterator[CdpSession]: |
| 424 | """Context manager opens a session and enables the "simple" style of calling CDP APIs. |
| 425 | |
| 426 | For example, inside a session context, you can call ``await |
| 427 | dom.get_document()`` and it will execute on the current session |
| 428 | automatically. |
| 429 | """ |
| 430 | session = await self.connect_session(target_id) |
| 431 | with session_context(session): |
| 432 | yield session |
| 433 | |
| 434 | async def connect_session(self, target_id) -> "CdpSession": |
| 435 | """Returns a new :class:`CdpSession` connected to the specified target.""" |
no test coverage detected