You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sources/k6/next/javascript-api/k6-browser/frame/_index.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,3 +56,4 @@ Frame represents a single frame in a browser window. It can be a top-level frame
56
56
|[waitForNavigation([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/frame/waitfornavigation/)| Waits for the given navigation lifecycle event to occur and returns the main resource response. |
57
57
|[waitForSelector(selector[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/frame/waitforselector/)| Returns when element specified by selector satisfies `state` option. |
58
58
|[waitForTimeout(timeout)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/frame/waitfortimeout)| Waits for the given `timeout` in milliseconds. |
59
+
|[waitForURL(url[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/frame/waitforurl/)| Waits for the frame to navigate to the specified URL. |
| 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/). |
16
-
| options.waitUntil | string |`load`| When to consider operation to have succeeded. See [Events](#events) for more details. |
| 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/). |
16
+
| options.url | string\|RegExp |`null`| URL or URL pattern to match the navigation URL against. Useful when frame navigation performs multiple redirects and you need to wait until a final destination within the frame is reached. |
17
+
| options.waitUntil | string |`load`| When to consider operation to have succeeded. See [Events](#events) for more details. |
17
18
18
19
</TableWithNestedRows>
19
20
21
+
### When to use the url option
22
+
23
+
Use `options.url` when frame navigation passes through several intermediate pages (e.g., third‑party authentication or consent flows) before settling on a final URL. Matching the final URL or a regex pattern helps you reliably wait for the intended destination inside the frame. However, opt to work with [waitForURL](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/frame/waitforurl) instead since it mitigates the risk of race conditions better than `waitForNavigation`.
| Promise<null \|[Response](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/response/)> | The `Response` instance associated with the frame. Else, it returns `null`|
Copy file name to clipboardExpand all lines: docs/sources/k6/next/javascript-api/k6-browser/page/_index.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,4 +72,5 @@ Page provides methods to interact with a single tab in a running web browser. A
72
72
|[waitForNavigation([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/waitfornavigation/)| Waits for the given navigation lifecycle event to occur and returns the main resource response. |
73
73
|[waitForSelector(selector[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/waitforselector/)| Returns when element specified by selector satisfies `state` option. |
74
74
|[waitForTimeout(timeout)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/waitfortimeout)| Waits for the given `timeout` in milliseconds. |
75
+
|[waitForURL(url[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/waitforurl/)| Waits for the page to navigate to the specified URL. |
75
76
|[workers()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/workers)| Returns an array of the dedicated [WebWorkers](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/worker) associated with the page. |
| 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/). |
16
-
| options.waitUntil | string |`load`| When to consider operation to have succeeded. See [Events](#events) for more details. |
| 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/). |
16
+
| options.url | string\|RegExp |`null`| URL or URL pattern to match the navigation URL against. When provided, the method will wait for navigation to a URL that matches this parameter. |
17
+
| options.waitUntil | string |`load`| When to consider operation to have succeeded. See [Events](#events) for more details. |
17
18
18
19
</TableWithNestedRows>
19
20
21
+
## When to use the url option
22
+
23
+
Use `options.url` when frame navigation passes through several intermediate pages (e.g., third‑party authentication or consent flows) before settling on a final URL. Matching the final URL or a regex pattern helps you reliably wait for the intended destination. However, opt to work with [waitForURL](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/waitforurl) instead since it mitigates the risk of race conditions better than `waitForNavigation`.
| Promise<null \|[Response](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/response/)> | The `Response` instance associated with the page. Else, it returns `null`|
39
44
40
-
### Example
45
+
### Examples
46
+
47
+
#### Basic navigation waiting
41
48
42
49
{{< code >}}
43
50
@@ -69,13 +76,10 @@ export default async function () {
0 commit comments