mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
34ff00e2fe
* fix: added parts of website * fix: removed unnecessary lines * fix: updated contributing.md * fix: added parts of sidebar * fix: added all APIs * fix: added version 10.0.0 Co-authored-by: Jack Franklin <jacktfranklin@chromium.org>
38 lines
1.9 KiB
Markdown
38 lines
1.9 KiB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Frame](./puppeteer.frame.md) > [waitFor](./puppeteer.frame.waitfor.md)
|
|
|
|
## Frame.waitFor() method
|
|
|
|
> Warning: This API is now obsolete.
|
|
>
|
|
> Don't use this method directly. Instead use the more explicit methods available: [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md), [Frame.waitForXPath()](./puppeteer.frame.waitforxpath.md), [Frame.waitForFunction()](./puppeteer.frame.waitforfunction.md) or [Frame.waitForTimeout()](./puppeteer.frame.waitfortimeout.md).
|
|
>
|
|
|
|
<b>Signature:</b>
|
|
|
|
```typescript
|
|
waitFor(selectorOrFunctionOrTimeout: string | number | Function, options?: Record<string, unknown>, ...args: SerializableOrJSHandle[]): Promise<JSHandle | null>;
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| selectorOrFunctionOrTimeout | string \| number \| Function | a selector, predicate or timeout to wait for. |
|
|
| options | Record<string, unknown> | optional waiting parameters. |
|
|
| args | [SerializableOrJSHandle](./puppeteer.serializableorjshandle.md)\[\] | arguments to pass to <code>pageFunction</code>. |
|
|
|
|
<b>Returns:</b>
|
|
|
|
Promise<[JSHandle](./puppeteer.jshandle.md) \| null>
|
|
|
|
## Remarks
|
|
|
|
This method behaves differently depending on the first parameter. If it's a `string`, it will be treated as a `selector` or `xpath` (if the string starts with `//`). This method then is a shortcut for [Frame.waitForSelector()](./puppeteer.frame.waitforselector.md) or [Frame.waitForXPath()](./puppeteer.frame.waitforxpath.md).
|
|
|
|
If the first argument is a function this method is a shortcut for [Frame.waitForFunction()](./puppeteer.frame.waitforfunction.md).
|
|
|
|
If the first argument is a `number`, it's treated as a timeout in milliseconds and the method returns a promise which resolves after the timeout.
|
|
|