Skip to content

Commit 3da553b

Browse files
inancgumusschalksnyman
authored andcommitted
Async frame.goto
1 parent 8a87f32 commit 3da553b

File tree

1 file changed

+42
-0
lines changed
  • docs/sources/next/javascript-api/k6-browser/frame

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: 'goto(url[, options])'
3+
description: 'Browser module: frame.goto(url[, options]) method'
4+
---
5+
6+
# goto(url[, options])
7+
8+
Navigates to the specified URL and returns the main resource response.
9+
10+
Navigating to `about:blank` or navigation to the same URL with a different hash, will succeed and return `null`.
11+
12+
<TableWithNestedRows>
13+
14+
| Parameter | Type | Default | Description |
15+
| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
16+
| url | string | `''` | URL to navigate frame to. The url should include scheme, e.g. `https://`. |
17+
| options | object | `null` | |
18+
| options.referer | string | `''` | Referer header value. |
19+
| options.timeout | number | `30000` | Maximum operation time in milliseconds. Pass `0` to disable the timeout. The default value can be changed via the [browserContext.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout/), [browserContext.setDefaultTimeout(timeout)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/browsercontext/setdefaulttimeout/), [page.setDefaultNavigationTimeout(timeout)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/setdefaultnavigationtimeout/) or [page.setDefaultTimeout(timeout)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/page/setdefaulttimeout/) methods. Setting the value to `0` will disable the timeout. |
20+
| options.waitUntil | string | `load` | When to consider operation to have succeeded. See [Events](#events) for more details. |
21+
22+
</TableWithNestedRows>
23+
24+
### Events
25+
26+
{{% admonition type="caution" %}}
27+
28+
`networkidle` is DISCOURAGED. Don't use this method for testing especially with chatty websites where the event may never fire, rely on web assertions to assess readiness instead.
29+
30+
{{% /admonition %}}
31+
32+
Events can be either:
33+
34+
- `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
35+
- `'load'` - consider operation to be finished when the `load` event is fired.
36+
- `'networkidle'` - Consider operation to be finished when there are no network connections for at least `500` ms.
37+
38+
### Returns
39+
40+
| Type | Description |
41+
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
42+
| `<Promise<Response \| null>` | The [Response](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/response/)> instance associated with the frame. Else, it returns `null`. |

0 commit comments

Comments
 (0)