Skip to main content
Version: 22.9.0

PredefinedNetworkConditions 变量

¥PredefinedNetworkConditions variable

Page.emulateNetworkConditions() 一起使用的网络条件列表。

¥A list of network conditions to be used with Page.emulateNetworkConditions().

签名:

¥Signature:

PredefinedNetworkConditions: Readonly<{
'Slow 3G': NetworkConditions;
'Fast 3G': NetworkConditions;
}>;

示例

¥Example

import {PredefinedNetworkConditions} from 'puppeteer';
const slow3G = PredefinedNetworkConditions['Slow 3G'];

(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.emulateNetworkConditions(slow3G);
await page.goto('https://www.google.com');
// other actions...
await browser.close();
})();