Skip to content

Commit 2d4317d

Browse files
authored
docs: fix browser.contexts() description (#1220)
1 parent f5a530e commit 2d4317d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docs/api.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,16 @@ The [Browser] object itself is considered to be disposed and cannot be used anym
173173
#### browser.contexts()
174174
- returns: <[Array]<[BrowserContext]>>
175175

176-
Returns an array of all open browser contexts. In a newly created browser, this will return
177-
a single instance of [BrowserContext].
176+
Returns an array of all open browser contexts. In a newly created browser, this will return zero
177+
browser contexts.
178+
179+
```js
180+
const browser = await pw.webkit.launch();
181+
console.log(browser.contexts().length); // prints `0`
182+
183+
const context = await browser.newContext();
184+
console.log(browser.contexts().length); // prints `1`
185+
```
178186

179187
#### browser.isConnected()
180188

0 commit comments

Comments
 (0)