Skip to content

Commit 8b64f7d

Browse files
inancgumusschalksnyman
authored andcommitted
Async frame.waitForFunction
1 parent aff6fb4 commit 8b64f7d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: 'waitForFunction(pageFunction, arg[, options])'
3+
description: 'Browser module: frame.waitForFunction(pageFunction, arg[, options]) method'
4+
---
5+
6+
# waitForFunction(pageFunction, arg[, options])
7+
8+
Returns when the `pageFunction` returns a truthy value.
9+
10+
<TableWithNestedRows>
11+
12+
| Parameter | Type | Default | Description |
13+
| --------------- | --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14+
| pageFunction | function | | Function to be evaluated in the page context. |
15+
| arg | string | `''` | Optional argument to pass to `pageFunction` |
16+
| options | object | `null` | |
17+
| options.polling | number or `raf` | `raf` | If `polling` is `'raf'`, then `pageFunction` is constantly executed in `requestAnimationFrame` callback. If `polling` is a number, then it is treated as an interval in milliseconds at which the function would be executed. |
18+
| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext/) or [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/). |
19+
20+
</TableWithNestedRows>
21+
22+
### Returns
23+
24+
| Type | Description |
25+
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
26+
| Promise<[JSHandle](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/jshandle/)> | The `JSHandle` instance associated with the page. |

0 commit comments

Comments
 (0)