puppeteer/new-docs/puppeteer.frame.waitfor.md
Jack Franklin 24cb6a28ad
chore(docs): document Frame class (#6188)
* chore: document Frame class
2020-07-09 14:22:58 +01:00

33 lines
1.5 KiB
Markdown

<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [Frame](./puppeteer.frame.md) &gt; [waitFor](./puppeteer.frame.waitfor.md)
## Frame.waitFor() method
<b>Signature:</b>
```typescript
waitFor(selectorOrFunctionOrTimeout: string | number | Function, options?: {}, ...args: SerializableOrJSHandle[]): Promise<JSHandle | null>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| selectorOrFunctionOrTimeout | string \| number \| Function | a selector, predicate or timeout to wait for. |
| options | {} | optional waiting parameters. |
| args | [SerializableOrJSHandle](./puppeteer.serializableorjshandle.md)<!-- -->\[\] | arguments to pass to <code>pageFunction</code>. |
<b>Returns:</b>
Promise&lt;[JSHandle](./puppeteer.jshandle.md) \| null&gt;
## 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.