chore: update documentation (#7446)

Reference `page.setOfflineMode` and `page.emulateNetworkConditions` from each other.
This commit is contained in:
Jan Scheffler 2021-07-30 10:41:42 +02:00 committed by GitHub
parent 5eb20e29a2
commit 18ed92bd08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -1706,7 +1706,8 @@ await page.evaluate(() => matchMedia('print').matches);
- `latency` <[number]> Latency (ms), `0` to disable
- returns: <[Promise]>
> **NOTE** This does not affect WebSockets and WebRTC PeerConnections (see https://crbug.com/563644)
> **NOTE** This does not affect WebSockets and WebRTC PeerConnections (see https://crbug.com/563644). To set the page offline, you can use [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
```js
const puppeteer = require('puppeteer');
@ -2326,6 +2327,8 @@ await page.setGeolocation({ latitude: 59.95, longitude: 30.31667 });
- `enabled` <[boolean]> When `true`, enables offline mode for the page.
- returns: <[Promise]>
> **NOTE** while this method sets the network connection to offline, it does not change the parameters used in [page.emulateNetworkConditions(networkConditions)](#pageemulatenetworkconditionsnetworkconditions).
#### page.setRequestInterception(value)
- `value` <[boolean]> Whether to enable request interception.

View File

@ -854,6 +854,10 @@ export class Page extends EventEmitter {
/**
* @param enabled - When `true`, enables offline mode for the page.
* @remarks
* NOTE: while this method sets the network connection to offline, it does
* not change the parameters used in [page.emulateNetworkConditions(networkConditions)]
* (#pageemulatenetworkconditionsnetworkconditions)
*/
setOfflineMode(enabled: boolean): Promise<void> {
return this._frameManager.networkManager().setOfflineMode(enabled);
@ -877,7 +881,8 @@ export class Page extends EventEmitter {
* ```
* @remarks
* NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
* https://crbug.com/563644)
* https://crbug.com/563644). To set the page offline, you can use
* [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
*/
emulateNetworkConditions(
networkConditions: NetworkConditions | null