puppeteer/website/versioned_docs/version-19.8.3/api/puppeteer.page.waitforframe.md
release-please[bot] 006086bc83
chore: release main (#9962)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2023-04-03 10:23:08 +02:00

46 lines
1.4 KiB
Markdown

---
sidebar_label: Page.waitForFrame
---
# Page.waitForFrame() method
#### Signature:
```typescript
class Page {
waitForFrame(
urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>),
options?: {
timeout?: number;
}
): Promise<Frame>;
}
```
## Parameters
| Parameter | Type | Description |
| -------------- | ------------------------------------------------------------------------------------------ | ---------------------------------------- |
| urlOrPredicate | string \| ((frame: [Frame](./puppeteer.frame.md)) =&gt; boolean \| Promise&lt;boolean&gt;) | A URL or predicate to wait for. |
| options | { timeout?: number; } | _(Optional)_ Optional waiting parameters |
**Returns:**
Promise&lt;[Frame](./puppeteer.frame.md)&gt;
Promise which resolves to the matched frame.
## Remarks
Optional Parameter have:
- `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds, pass `0` to disable the timeout. The default value can be changed by using the [Page.setDefaultTimeout()](./puppeteer.page.setdefaulttimeout.md) method.
## Example
```ts
const frame = await page.waitForFrame(async frame => {
return frame.name() === 'Test';
});
```