docs: fix browser.contexts() description (#1220)
This commit is contained in:
parent
f5a530e17f
commit
2d4317dc9a
12
docs/api.md
12
docs/api.md
|
|
@ -173,8 +173,16 @@ The [Browser] object itself is considered to be disposed and cannot be used anym
|
||||||
#### browser.contexts()
|
#### browser.contexts()
|
||||||
- returns: <[Array]<[BrowserContext]>>
|
- returns: <[Array]<[BrowserContext]>>
|
||||||
|
|
||||||
Returns an array of all open browser contexts. In a newly created browser, this will return
|
Returns an array of all open browser contexts. In a newly created browser, this will return zero
|
||||||
a single instance of [BrowserContext].
|
browser contexts.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const browser = await pw.webkit.launch();
|
||||||
|
console.log(browser.contexts().length); // prints `0`
|
||||||
|
|
||||||
|
const context = await browser.newContext();
|
||||||
|
console.log(browser.contexts().length); // prints `1`
|
||||||
|
```
|
||||||
|
|
||||||
#### browser.isConnected()
|
#### browser.isConnected()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue