MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / page_enable

Method page_enable

py/private/cdp.py:370–387  ·  view source on GitHub ↗

Context manager executes ``page.enable()`` when it enters and then calls ``page.disable()`` when it exits. This keeps track of concurrent callers and only disables page events when all callers have exited.

(self)

Source from the content-addressed store, hash-verified

368
369 @asynccontextmanager
370 async def page_enable(self):
371 """Context manager executes ``page.enable()`` when it enters and then calls ``page.disable()`` when it exits.
372
373 This keeps track of concurrent callers and only disables page
374 events when all callers have exited.
375 """
376 global devtools
377 async with self._page_enable_lock:
378 self._page_enable_count += 1
379 if self._page_enable_count == 1:
380 await self.execute(devtools.page.enable())
381
382 yield
383
384 async with self._page_enable_lock:
385 self._page_enable_count -= 1
386 if self._page_enable_count == 0:
387 await self.execute(devtools.page.disable())
388
389
390class CdpConnection(CdpBase, trio.abc.AsyncResource):

Callers

nothing calls this directly

Calls 3

executeMethod · 0.65
enableMethod · 0.65
disableMethod · 0.45

Tested by

no test coverage detected