2021-01-07 20:46:05 +01:00
|
|
|
# class: ChromiumBrowserContext
|
2021-02-02 19:21:27 +01:00
|
|
|
* langs: js, python
|
2021-01-07 20:46:05 +01:00
|
|
|
* extends: [BrowserContext]
|
|
|
|
|
|
|
|
|
|
Chromium-specific features including background pages, service worker support, etc.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
const backgroundPage = await context.waitForEvent('backgroundpage');
|
|
|
|
|
```
|
|
|
|
|
|
2021-01-14 16:48:56 +01:00
|
|
|
```python async
|
|
|
|
|
background_page = await context.wait_for_event("backgroundpage")
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```python sync
|
|
|
|
|
background_page = context.wait_for_event("backgroundpage")
|
|
|
|
|
```
|
|
|
|
|
|
2021-02-04 19:34:09 +01:00
|
|
|
## event: ChromiumBrowserContext.backgroundPage
|
2021-01-07 20:46:05 +01:00
|
|
|
- type: <[Page]>
|
|
|
|
|
|
|
|
|
|
Emitted when new background page is created in the context.
|
|
|
|
|
|
2021-01-12 21:14:27 +01:00
|
|
|
:::note
|
|
|
|
|
Only works with persistent context.
|
|
|
|
|
:::
|
2021-01-07 20:46:05 +01:00
|
|
|
|
2021-02-04 19:34:09 +01:00
|
|
|
## event: ChromiumBrowserContext.serviceWorker
|
2021-01-07 20:46:05 +01:00
|
|
|
- type: <[Worker]>
|
|
|
|
|
|
|
|
|
|
Emitted when new service worker is created in the context.
|
|
|
|
|
|
|
|
|
|
## method: ChromiumBrowserContext.backgroundPages
|
|
|
|
|
- returns: <[Array]<[Page]>>
|
|
|
|
|
|
|
|
|
|
All existing background pages in the context.
|
|
|
|
|
|
|
|
|
|
## async method: ChromiumBrowserContext.newCDPSession
|
|
|
|
|
- returns: <[CDPSession]>
|
|
|
|
|
|
|
|
|
|
Returns the newly created session.
|
|
|
|
|
|
|
|
|
|
### param: ChromiumBrowserContext.newCDPSession.page
|
|
|
|
|
- `page` <[Page]>
|
|
|
|
|
|
|
|
|
|
Page to create new session for.
|
|
|
|
|
|
|
|
|
|
## method: ChromiumBrowserContext.serviceWorkers
|
|
|
|
|
- returns: <[Array]<[Worker]>>
|
|
|
|
|
|
|
|
|
|
All existing service workers in the context.
|