2022-07-05 13:41:43 +00:00
|
|
|
---
|
|
|
|
sidebar_label: Page.waitForFrame
|
|
|
|
---
|
|
|
|
|
|
|
|
# Page.waitForFrame() method
|
|
|
|
|
2023-08-24 18:32:29 +00:00
|
|
|
Waits for a frame matching the given conditions to appear.
|
|
|
|
|
2022-10-24 07:07:05 +00:00
|
|
|
#### Signature:
|
2022-07-05 13:41:43 +00:00
|
|
|
|
|
|
|
```typescript
|
|
|
|
class Page {
|
|
|
|
waitForFrame(
|
2023-08-24 18:32:29 +00:00
|
|
|
urlOrPredicate: string | ((frame: Frame) => Awaitable<boolean>),
|
|
|
|
options?: WaitTimeoutOptions
|
2022-07-05 13:41:43 +00:00
|
|
|
): Promise<Frame>;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
2023-08-24 18:32:29 +00:00
|
|
|
| Parameter | Type | Description |
|
|
|
|
| -------------- | ------------------------------------------------------------------------------------------------------------- | ------------ |
|
|
|
|
| urlOrPredicate | string \| ((frame: [Frame](./puppeteer.frame.md)) => [Awaitable](./puppeteer.awaitable.md)<boolean>) | |
|
|
|
|
| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ |
|
2022-07-05 13:41:43 +00:00
|
|
|
|
|
|
|
**Returns:**
|
|
|
|
|
|
|
|
Promise<[Frame](./puppeteer.frame.md)>
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```ts
|
|
|
|
const frame = await page.waitForFrame(async frame => {
|
|
|
|
return frame.name() === 'Test';
|
|
|
|
});
|
|
|
|
```
|