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 - `latency` <[number]> Latency (ms), `0` to disable
- returns: <[Promise]> - 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 ```js
const puppeteer = require('puppeteer'); const puppeteer = require('puppeteer');
@ -2323,9 +2324,11 @@ await page.setGeolocation({ latitude: 59.95, longitude: 30.31667 });
#### page.setOfflineMode(enabled) #### page.setOfflineMode(enabled)
- `enabled` <[boolean]> When `true`, enables offline mode for the page. - `enabled` <[boolean]> When `true`, enables offline mode for the page.
- returns: <[Promise]> - 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) #### page.setRequestInterception(value)
- `value` <[boolean]> Whether to enable request interception. - `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. * @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> { setOfflineMode(enabled: boolean): Promise<void> {
return this._frameManager.networkManager().setOfflineMode(enabled); return this._frameManager.networkManager().setOfflineMode(enabled);
@ -877,7 +881,8 @@ export class Page extends EventEmitter {
* ``` * ```
* @remarks * @remarks
* NOTE: This does not affect WebSockets and WebRTC PeerConnections (see * 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( emulateNetworkConditions(
networkConditions: NetworkConditions | null networkConditions: NetworkConditions | null