playwright/docs/out/api/class-chromiumbrowsercontext.md

7.8 KiB

id title
class-chromiumbrowsercontext ChromiumBrowserContext

Chromium-specific features including background pages, service worker support, etc.

const backgroundPage = await context.waitForEvent('backgroundpage');

chromiumBrowserContext.on('backgroundpage')

Emitted when new background page is created in the context.

Note

Only works with persistent context.

chromiumBrowserContext.on('serviceworker')

Emitted when new service worker is created in the context.

chromiumBrowserContext.backgroundPages()

All existing background pages in the context.

chromiumBrowserContext.newCDPSession(page)

Returns the newly created session.

chromiumBrowserContext.serviceWorkers()

All existing service workers in the context.