Page.emulateIdleState() 方法
¥Page.emulateIdleState() method
模拟空闲状态。如果未设置参数,则清除空闲状态模拟。
¥Emulates the idle state. If no arguments set, clears idle state emulation.
签名
¥Signature
class Page {
abstract emulateIdleState(overrides?: {
isUserActive: boolean;
isScreenUnlocked: boolean;
}): Promise<void>;
}
参数
¥Parameters
范围 | 类型 | 描述 |
---|---|---|
overrides | { isUserActive: boolean; isScreenUnlocked: boolean; } | (可选的)模拟空闲状态。如果未设置,则清除空闲覆盖 |
Returns:
Promise<void>
示例
¥Example
// set idle emulation
await page.emulateIdleState({isUserActive: true, isScreenUnlocked: false});
// do some checks here
...
// clear idle emulation
await page.emulateIdleState();