Skip to content

Commit

Permalink
feat: allow to create isolated context
Browse files Browse the repository at this point in the history
Implementes puppeteer#2671. Add documentation
  • Loading branch information
furstenheim committed Jun 30, 2018
1 parent e632cae commit 8f10cee
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
* [page.content()](#pagecontent)
* [page.cookies(...urls)](#pagecookiesurls)
* [page.coverage](#pagecoverage)
* [page.createNewIsolatedContext(contextIdentifier)](#pagecreatenewisolatedcontextcontextidentifier)
* [page.deleteCookie(...cookies)](#pagedeletecookiecookies)
* [page.emulate(options)](#pageemulateoptions)
* [page.emulateMedia(mediaType)](#pageemulatemediamediatype)
Expand Down Expand Up @@ -922,6 +923,22 @@ If URLs are specified, only cookies for those URLs are returned.

- returns: <[Coverage]>


#### page.createNewIsolatedContext(contextIdentifier)
- `contextIdentifier`<[string]> Identifier to assign to the new isolated context
- returns: <[Promise]<[ExecutionContext]>> Promise which resolves to the new isolatedContext

Creates a new isolated context for the page. Context are able to access DOM but have an independent [JavaScript environment](https://developer.chrome.com/extensions/content_scripts).
This allows executing code without conflicts with the current website.

```js

const context = await page.createNewIsolatedContext('myIsolatedWorld')
await context.evaluate(function () {
// DOM is shared with page but JS Environment is not
})
```

#### page.deleteCookie(...cookies)
- `...cookies` <...[Object]>
- `name` <[string]> **required**
Expand Down

0 comments on commit 8f10cee

Please sign in to comment.