mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
38 lines
1.1 KiB
Markdown
38 lines
1.1 KiB
Markdown
|
---
|
||
|
sidebar_label: Page.waitForFrame
|
||
|
---
|
||
|
|
||
|
# Page.waitForFrame() method
|
||
|
|
||
|
Waits for a frame matching the given conditions to appear.
|
||
|
|
||
|
#### Signature:
|
||
|
|
||
|
```typescript
|
||
|
class Page {
|
||
|
waitForFrame(
|
||
|
urlOrPredicate: string | ((frame: Frame) => Awaitable<boolean>),
|
||
|
options?: WaitTimeoutOptions
|
||
|
): Promise<Frame>;
|
||
|
}
|
||
|
```
|
||
|
|
||
|
## Parameters
|
||
|
|
||
|
| Parameter | Type | Description |
|
||
|
| -------------- | ------------------------------------------------------------------------------------------------------------- | ------------ |
|
||
|
| urlOrPredicate | string \| ((frame: [Frame](./puppeteer.frame.md)) => [Awaitable](./puppeteer.awaitable.md)<boolean>) | |
|
||
|
| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ |
|
||
|
|
||
|
**Returns:**
|
||
|
|
||
|
Promise<[Frame](./puppeteer.frame.md)>
|
||
|
|
||
|
## Example
|
||
|
|
||
|
```ts
|
||
|
const frame = await page.waitForFrame(async frame => {
|
||
|
return frame.name() === 'Test';
|
||
|
});
|
||
|
```
|