mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
f07ad2c661
This PR updates the docs regarding configuring puppeteer. In addition, some changes have been made to the documentation generator to show default values on the documentation site. Also fixes: https://github.com/puppeteer/puppeteer/pull/9144
46 lines
1.4 KiB
Markdown
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)) => boolean \| Promise<boolean>) | A URL or predicate to wait for. |
|
|
| options | { timeout?: number; } | <i>(Optional)</i> Optional waiting parameters |
|
|
|
|
**Returns:**
|
|
|
|
Promise<[Frame](./puppeteer.frame.md)>
|
|
|
|
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';
|
|
});
|
|
```
|