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 | (可选的) |
Returns:
Promise<Frame>
示例
¥Example
const frame = await page.waitForFrame(async frame => {
return frame.name() === 'Test';
});