Skip to main content
Version: 23.2.0

Page.waitForFrame() 方法

¥Page.waitForFrame() method

等待匹配给定条件的帧出现。

¥Waits for a frame matching the given conditions to appear.

签名

¥Signature

class Page {
waitForFrame(
urlOrPredicate: string | ((frame: Frame) => Awaitable<boolean>),
options?: WaitTimeoutOptions
): Promise<Frame>;
}

参数

¥Parameters

范围

类型

描述

urlOrPredicate

字符串| ((帧:框架)=> 等待的<布尔>)

options

WaitTimeoutOptions

(可选的)

Returns:

Promise<Frame>

示例

¥Example

const frame = await page.waitForFrame(async frame => {
return frame.name() === 'Test';
});