-
-
-
-);
+
+ );
+};
diff --git a/src/components/pages/doc-welcome/outdated-blockquote/index.js b/src/components/pages/doc-welcome/outdated-blockquote/index.js
deleted file mode 100644
index c156aec5c0..0000000000
--- a/src/components/pages/doc-welcome/outdated-blockquote/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export { OutdatedBlockquote } from './outdated-blockquote.view';
diff --git a/src/components/pages/doc-welcome/outdated-blockquote/outdated-blockquote.view.js b/src/components/pages/doc-welcome/outdated-blockquote/outdated-blockquote.view.js
deleted file mode 100644
index 7c559927e9..0000000000
--- a/src/components/pages/doc-welcome/outdated-blockquote/outdated-blockquote.view.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import Blockquote from 'components/shared/blockquote';
-import React from 'react';
-
-export const OutdatedBlockquote = () => (
-
-
-
- We've migrated the k6 documentation to Grafana!{' '}
-
- Click here
- {' '}
- to view the latest version of the k6 documentation.
-
-
- This page is still available for users to be able to view the{' '}
-
- k6 Cloud documentation
-
- , and will be removed at a later date.
-
-
-
-
-);
diff --git a/src/components/pages/doc-welcome/use-cases/use-cases.view.js b/src/components/pages/doc-welcome/use-cases/use-cases.view.js
index 639f46a82b..a7f8e3d2c1 100644
--- a/src/components/pages/doc-welcome/use-cases/use-cases.view.js
+++ b/src/components/pages/doc-welcome/use-cases/use-cases.view.js
@@ -1,5 +1,6 @@
import { Heading } from 'components/shared/heading';
import { useI18n } from 'contexts/i18n-provider';
+import { useLocale } from 'contexts/locale-provider';
import { Link } from 'gatsby';
import React from 'react';
@@ -7,6 +8,7 @@ import styles from './use-cases.module.scss';
export const UseCases = () => {
const { t } = useI18n();
+ const { urlLocale } = useLocale();
return (
@@ -24,7 +26,9 @@ export const UseCases = () => {
spike
@@ -33,7 +37,9 @@ export const UseCases = () => {
stress
@@ -42,7 +48,9 @@ export const UseCases = () => {
soak tests
@@ -57,10 +65,7 @@ export const UseCases = () => {
{t('welcome.use-cases.browser-testing.pre-description')}
-
+
k6 browser
{t('welcome.use-cases.browser-testing.description')}
@@ -71,15 +76,8 @@ export const UseCases = () => {
{t('welcome.use-cases.chaos-testing.title')}
- You can use k6 to simulate traffic as part of your chaos
- experiments, trigger them from your k6 tests or inject different
- types of faults in Kubernetes with{' '}
-
+ {t('welcome.use-cases.chaos-testing.description')}
+
xk6-disruptor
.
@@ -89,22 +87,7 @@ export const UseCases = () => {
{t('welcome.use-cases.performance-monitoring.title')}
-
- With k6, you can automate and schedule to trigger tests very
- frequently with a small load to continuously validate the
- performance and availability of your production environment. You can
- also use{' '}
-
- Grafana Cloud Synthetic Monitoring
- {' '}
- for a managed solution built specifically for synthetic monitoring
- that supports k6 test scripts.
-
+ {t('welcome.use-cases.performance-monitoring.description')}
diff --git a/src/data/markdown/docs/02 javascript api/01 Init context.md b/src/data/markdown/docs/02 javascript api/01 Init context.md
index a9be961100..c5b5f2572d 100644
--- a/src/data/markdown/docs/02 javascript api/01 Init context.md
+++ b/src/data/markdown/docs/02 javascript api/01 Init context.md
@@ -2,7 +2,12 @@
title: "Init context"
excerpt: 'The init context (aka "init code") is code in the global context that has access to a few functions not accessible during main script execution.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/init-context/
-redirect: https://grafana.com/docs/k6/latest/javascript-api/init-context/
---
Before the k6 starts the test logic, code in the _init context_ prepares the script.
+A few functions are available only in init context.
+For details about the runtime, refer to the [Test lifecycle](/using-k6/test-lifecycle).
+
+| Function | Description |
+| ----------------------------------------------------------------------------------- | --------------------- |
+| [open( filePath, [mode] )](/javascript-api/init-context/open) | Opens a file and reads all the contents into memory. |
diff --git a/src/data/markdown/docs/02 javascript api/01 Init context/open.md b/src/data/markdown/docs/02 javascript api/01 Init context/open.md
new file mode 100644
index 0000000000..77b90a61a4
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/01 Init context/open.md
@@ -0,0 +1,113 @@
+---
+head_title: 'JavaScript API: open'
+title: 'open( filePath, [mode] )'
+description: 'Opens a file and reads all the contents into memory.'
+excerpt: 'Opens a file and reads all the contents into memory.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/init-context/open/
+---
+
+Opens a file, reading all its contents into memory for use in the script.
+
+> #### Use [SharedArray](/javascript-api/k6-data/sharedarray/) for CSV and JSON files
+> `open()` often consumes a large amount of memory because every VU keeps a separate copy of the file in memory.
+> To reduce the memory consumption, we strongly advise the usage of [SharedArray](/javascript-api/k6-data/sharedarray/) for CSV, JSON and other files intended for script parametrization.
+
+
+
+This function can only be called from the init context (aka _init code_), code in the global context that is, outside of the main export default function { ... }.
+
+By restricting it to the init context, we can easily determine what local files are needed to run the test and thus what we need to bundle up when distributing the test to multiple nodes in a clustered/distributed test.
+
+See the example further down on this page. For a more in-depth description, see [Test lifecycle](/using-k6/test-lifecycle).
+
+
+
+| Parameter | Type | Description |
+| --------- | ------ | ------------------ |
+| filePath | string | The path to the file, absolute or relative, that will be read into memory. The file will only be loaded once, even when running with several VUs. |
+| mode | string | By default, the contents of the file are read as text, but if you specify `b`, the file will be read as binary data instead. |
+
+### Returns
+
+| Type | Description |
+| ---- | ----------- |
+| string / ArrayBuffer | The contents of the file, returned as string or ArrayBuffer (if `b` was specified as the mode). |
+
+
+
+
+```json
+[
+ {
+ "username": "user1",
+ "password": "password1"
+ },
+ {
+ "username": "user2",
+ "password": "password2"
+ },
+ {
+ "username": "user3",
+ "password": "password3"
+ }
+]
+```
+
+
+
+
+
+```javascript
+import { SharedArray } from 'k6/data';
+import { sleep } from 'k6';
+
+const data = new SharedArray('users', function () {
+ // here you can open files, and then do additional processing or generate the array with data dynamically
+ const f = JSON.parse(open('./users.json'));
+ return f; // f must be an array[]
+});
+
+export default () => {
+ const randomUser = data[Math.floor(Math.random() * data.length)];
+ console.log(`${randomUser.username}, ${randomUser.password}`);
+ sleep(3);
+};
+```
+
+
+
+
+
+```javascript
+import { sleep } from 'k6';
+
+const users = JSON.parse(open('./users.json')); // consider using SharedArray for large files
+
+export default function () {
+ const user = users[__VU - 1];
+ console.log(`${user.username}, ${user.password}`);
+ sleep(3);
+}
+```
+
+
+
+
+
+```javascript
+import http from 'k6/http';
+import { sleep } from 'k6';
+
+const binFile = open('/path/to/file.bin', 'b');
+
+export default function () {
+ const data = {
+ field: 'this is a standard form field',
+ file: http.file(binFile, 'test.bin'),
+ };
+ const res = http.post('https://example.com/upload', data);
+ sleep(3);
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/02 k6.md b/src/data/markdown/docs/02 javascript api/02 k6.md
index f0143895dc..dbd889ce7d 100644
--- a/src/data/markdown/docs/02 javascript api/02 k6.md
+++ b/src/data/markdown/docs/02 javascript api/02 k6.md
@@ -2,7 +2,14 @@
title: 'k6'
excerpt: 'The k6 module contains k6-specific functionality.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/
-redirect: https://grafana.com/docs/k6/latest/javascript-api/k6/
---
The k6 module contains k6-specific functionality.
+
+| Function | Description |
+| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
+| [check(val, sets, [tags])](/javascript-api/k6/check) | Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure. |
+| [fail([err])](/javascript-api/k6/fail) | Throws an error, failing and aborting the current VU script iteration immediately. |
+| [group(name, fn)](/javascript-api/k6/group) | Runs code inside a group. Used to organize results in a test. |
+| [randomSeed(int)](/javascript-api/k6/randomseed) | Set seed to get a reproducible pseudo-random number using `Math.random`. |
+| [sleep(t)](/javascript-api/k6/sleep) | Suspends VU execution for the specified duration. |
diff --git a/src/data/markdown/docs/02 javascript api/02 k6/check- val- sets- -tags- -.md b/src/data/markdown/docs/02 javascript api/02 k6/check- val- sets- -tags- -.md
new file mode 100644
index 0000000000..cf7c89185f
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/02 k6/check- val- sets- -tags- -.md
@@ -0,0 +1,73 @@
+---
+title: 'check( val, sets, [tags] )'
+description: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
+excerpt: 'Runs one or more checks on a value and generates a pass/fail result but does not throw errors or otherwise interrupt execution upon failure.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/check/
+---
+
+Run checks on a value. A check is a test condition that can give a truthy or
+falsy result. The `sets` parameter contains one or more checks, and the `check()`
+function will return `false` if any of them fail.
+
+Note that checks are not _asserts_ in their traditional sense - a failed assertion
+will throw an error, while a check will always return with a pass or a failure.
+Failure conditions can then instead be controlled by thresholds, for more power and flexibility.
+
+| Parameter | Type | Description |
+| --------------- | ------ | ---------------------------------------- |
+| val | any | Value to test. |
+| sets | object | Tests (checks) to run on the value. |
+| tags (optional) | object | Extra tags to attach to metrics emitted. |
+
+### Returns
+
+| Type | Description |
+| ------- | ------------------------------------------------------- |
+| boolean | `true` if all checks have succeeded, `false` otherwise. |
+
+### Examples
+
+Using `check()` to verify that an HTTP response code was 200:
+
+
+
+```javascript
+import http from 'k6/http';
+import { check } from 'k6';
+
+export default function () {
+ const res = http.get('https://httpbin.test.k6.io');
+ check(res, {
+ 'response code was 200': (res) => res.status == 200,
+ });
+}
+```
+
+
+
+Using `check()` with a custom tag to verify that an HTTP response code was 200 and that body was 1234 bytes. The `checkOutput` can be used for any condition in your script logic:
+
+
+
+```javascript
+import http from 'k6/http';
+import { check, fail } from 'k6';
+
+export default function () {
+ const res = http.get('https://httpbin.test.k6.io');
+ const checkOutput = check(
+ res,
+ {
+ 'response code was 200': (res) => res.status == 200,
+ 'body size was 1234 bytes': (res) => res.body.length == 1234,
+ },
+ { myTag: "I'm a tag" }
+ );
+
+ if (!checkOutput) {
+ fail('unexpected response');
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/02 k6/fail- -err- -.md b/src/data/markdown/docs/02 javascript api/02 k6/fail- -err- -.md
new file mode 100644
index 0000000000..6e555e608c
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/02 k6/fail- -err- -.md
@@ -0,0 +1,42 @@
+---
+title: 'fail( [err] )'
+description: 'Throws an error, failing and aborting the current VU script iteration immediately.'
+excerpt: 'Throws an error, failing and aborting the current VU script iteration immediately.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/fail/
+---
+
+Immediately throw an error, aborting the current iteration.
+
+`fail()` does not abort the test, nor does it make the test exit with non-0 status.
+If you are looking to fail the test by halting the execution, use [test.abort()](/javascript-api/k6-execution/#test) instead
+
+`fail()` is a simple convenience wrapper on top of JavaScript's `throw()`,
+because the latter cannot be used as `[expr] || throw`, which is a convenient way to write k6 test code.
+
+| Parameter | Type | Description |
+| -------------- | ------ | ------------------------------------------ |
+| err (optional) | string | Error message that gets printed to stderr. |
+
+### Example
+
+Aborting the current script iteration if a check fails:
+
+
+
+```javascript
+import http from 'k6/http';
+import { check, fail } from 'k6';
+
+export default function () {
+ const res = http.get('https://k6.io');
+ if (
+ !check(res, {
+ 'status code MUST be 200': (res) => res.status == 200,
+ })
+ ) {
+ fail('status code was *not* 200');
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/02 k6/group- name- fn -.md b/src/data/markdown/docs/02 javascript api/02 k6/group- name- fn -.md
new file mode 100644
index 0000000000..b814c23077
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/02 k6/group- name- fn -.md
@@ -0,0 +1,66 @@
+---
+title: 'group( name, fn )'
+description: 'Runs code inside a group. Used to organize results in a test.'
+excerpt: 'Runs code inside a group. Used to organize results in a test.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/group/
+---
+
+Run code inside a group. Groups are used to organize results in a test.
+
+| Parameter | Type | Description |
+| --------- | -------- | ------------------------------------------------------ |
+| name | string | Name of the group. |
+| fn | function | Group body - code to be executed in the group context. |
+
+### Returns
+
+| Type | Description |
+| ---- | ------------------------- |
+| any | The return value of _fn_. |
+
+
+
+Avoid using `group` with async functions or asynchronous code.
+If you do, k6 might apply tags in a way that is unreliable or unintuitive.
+
+If you start promise chains or even use `await` within `group`, some code within the group will be waited for and tagged with the proper `group` tag, but others won't be.
+
+To avoid confusion, `async` functions are forbidden as `group()` arguments. This still lets users make and chain promises within a group, but doing so is unsupported and not recommended.
+
+For more information, refer to [k6 #2728](https://github.com/grafana/k6/issues/2728), which tracks possible solutions and provides detailed explanations.
+
+
+
+### Example
+
+
+
+```javascript
+import { group } from 'k6';
+
+export default function () {
+ group('visit product listing page', function () {
+ // ...
+ });
+ group('add several products to the shopping cart', function () {
+ // ...
+ });
+ group('visit login page', function () {
+ // ...
+ });
+ group('authenticate', function () {
+ // ...
+ });
+ group('checkout process', function () {
+ // ...
+ });
+}
+```
+
+
+
+The above code will present the results separately depending on the group execution.
+
+Learn more on [Groups and Tags](/using-k6/tags-and-groups).
+
+
diff --git a/src/data/markdown/docs/02 javascript api/02 k6/images/groups.png b/src/data/markdown/docs/02 javascript api/02 k6/images/groups.png
new file mode 100644
index 0000000000..4135d30379
Binary files /dev/null and b/src/data/markdown/docs/02 javascript api/02 k6/images/groups.png differ
diff --git a/src/data/markdown/docs/02 javascript api/02 k6/random-seed.md b/src/data/markdown/docs/02 javascript api/02 k6/random-seed.md
new file mode 100644
index 0000000000..3906e88377
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/02 k6/random-seed.md
@@ -0,0 +1,35 @@
+---
+title: 'randomSeed( int )'
+description: 'Set seed to get a reproducible pseudo-random number using `Math.random`.'
+excerpt: 'Set seed to get a reproducible pseudo-random number using `Math.random`.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/random-seed/
+---
+
+Set seed to get a reproducible pseudo-random number using `Math.random`.
+
+| Parameter | Type | Description |
+| --------- | ------- | --------------- |
+| int | integer | The seed value. |
+
+### Example
+
+Use `randomSeed` to get the same random number in all the iterations.
+
+
+
+```javascript
+import { randomSeed } from 'k6';
+
+export const options = {
+ vus: 10,
+ duration: '5s',
+};
+
+export default function () {
+ randomSeed(123456789);
+ const rnd = Math.random();
+ console.log(rnd);
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/02 k6/sleep- t -.md b/src/data/markdown/docs/02 javascript api/02 k6/sleep- t -.md
new file mode 100644
index 0000000000..40826fdfc9
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/02 k6/sleep- t -.md
@@ -0,0 +1,49 @@
+---
+title: 'sleep( t )'
+description: 'Suspends VU execution for the specified duration.'
+excerpt: 'Suspends VU execution for the specified duration.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6/sleep/
+---
+
+Suspend VU execution for the specified duration.
+
+| Parameter | Type | Description |
+| --------- | ------ | --------------------- |
+| t | number | Duration, in seconds. |
+
+### Examples
+
+Fetching two different pages with a 0-30 second random sleep in between:
+
+
+
+```javascript
+import { sleep } from 'k6';
+import http from 'k6/http';
+
+export default function () {
+ http.get('https://k6.io');
+ sleep(Math.random() * 30);
+ http.get('https://k6.io/features');
+}
+```
+
+
+
+Using the [k6-utils](https://k6.io/docs/javascript-api/jslib/utils) library to specify a range between a minimum and maximum:
+
+
+
+```javascript
+import { sleep } from 'k6';
+import http from 'k6/http';
+import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
+
+export default function () {
+ http.get('https://k6.io');
+ sleep(randomIntBetween(20, 30));
+ http.get('https://k6.io/features');
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto.md
index 1fd0d5bdf2..3194a13f93 100644
--- a/src/data/markdown/docs/02 javascript api/03 k6-crypto.md
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto.md
@@ -2,6 +2,29 @@
title: "k6/crypto"
excerpt: "The k6/crypto module provides common hashing functionality available in the GoLang crypto."
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/
-redirect: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/
---
+
+
+The k6/crypto `module` provides common hashing functionality available in the GoLang [crypto](https://golang.org/pkg/crypto/) package.
+
+| Function | Description |
+| -------- | ----------- |
+| [createHash(algorithm)](/javascript-api/k6-crypto/createhash) | Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way. |
+| [createHMAC(algorithm, secret)](/javascript-api/k6-crypto/createhmac) | Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way. |
+| [hmac(algorithm, secret, data, outputEncoding)](/javascript-api/k6-crypto/hmac) | Use HMAC to sign an input string. |
+| [md4(input, outputEncoding)](/javascript-api/k6-crypto/md4) | Use MD4 to hash an input string. |
+| [md5(input, outputEncoding)](/javascript-api/k6-crypto/md5) | Use MD5 to hash an input string. |
+| [randomBytes(int)](/javascript-api/k6-crypto/randombytes) | Return an array with a number of cryptographically random bytes. |
+| [ripemd160(input, outputEncoding)](/javascript-api/k6-crypto/ripemd160) | Use RIPEMD-160 to hash an input string. |
+| [sha1(input, outputEncoding)](/javascript-api/k6-crypto/sha1) | Use SHA-1 to hash an input string. |
+| [sha256(input, outputEncoding)](/javascript-api/k6-crypto/sha256) | Use SHA-256 to hash an input string. |
+| [sha384(input, outputEncoding)](/javascript-api/k6-crypto/sha384) | Use SHA-384 to hash an input string. |
+| [sha512(input, outputEncoding)](/javascript-api/k6-crypto/sha512) | Use SHA-512 to hash an input string. |
+| [sha512_224(input, outputEncoding)](/javascript-api/k6-crypto/sha512_224) | Use SHA-512/224 to hash an input string. |
+| [sha512_256(input, outputEncoding)](/javascript-api/k6-crypto/sha512_256) | Use SHA-512/256 to hash an input string. |
+
+
+| Class | Description |
+| -------- | ----------- |
+| [Hasher](/javascript-api/k6-crypto/hasher) | Object returned by [crypto.createHash()](/javascript-api/k6-crypto/createhash). It allows adding more data to be hashed and to extract digests along the way. |
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/01-createHash- algorithm -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/01-createHash- algorithm -.md
new file mode 100644
index 0000000000..efb2996c4c
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/01-createHash- algorithm -.md
@@ -0,0 +1,45 @@
+---
+title: 'createHash( algorithm )'
+description: 'Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
+excerpt: 'Create a Hasher object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/createhash/
+---
+
+
+
+Creates a hashing object that can then be fed with data repeatedly, and from which you can extract a hash digest whenever you want.
+
+| Parameter | Type | Description |
+| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| algorithm | string | The name of the hashing algorithm you want to use. Can be any one of "md4", "md5", "sha1", "sha256", "sha384", "sha512", "sha512_224", "sha512_256", "ripemd160". |
+
+### Returns
+
+| Type | Description |
+| ------ | ---------------------------------------------------- |
+| object | A [Hasher](/javascript-api/k6-crypto/hasher) object. |
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ console.log(crypto.sha256('hello world!', 'hex'));
+ const hasher = crypto.createHash('sha256');
+ hasher.update('hello ');
+ hasher.update('world!');
+ console.log(hasher.digest('hex'));
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
+INFO[0000] 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/02-createHMAC- algorithm- secret -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/02-createHMAC- algorithm- secret -.md
new file mode 100644
index 0000000000..8fd274a153
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/02-createHMAC- algorithm- secret -.md
@@ -0,0 +1,46 @@
+---
+title: 'createHMAC( algorithm, secret )'
+description: 'Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
+excerpt: 'Create an HMAC hashing object, allowing the user to add data to hash multiple times, and extract hash digests along the way.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/createhmac/
+---
+
+
+
+Creates a HMAC hashing object that can then be fed with data repeatedly, and from which you can extract a signed hash digest whenever you want.
+
+| Parameter | Type | Description |
+| --------- | :----: | :---------------------------------------------------------------------------------------------------------------------------------- |
+| algorithm | string | The hashing algorithm to use. One of `md4`, `md5`, `sha1`, `sha256`, `sha384`, `sha512`, `sha512_224`, `sha512_256` or `ripemd160`. |
+| secret | string / ArrayBuffer | A shared secret used to sign the data. |
+
+### Returns
+
+| Type | Description |
+| ------ | :--------------------------------------------------- |
+| object | A [Hasher](/javascript-api/k6-crypto/hasher) object. |
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ console.log(crypto.hmac('sha256', 'a secret', 'my data', 'hex'));
+ const hasher = crypto.createHMAC('sha256', 'a secret');
+ hasher.update('my ');
+ hasher.update('data');
+ console.log(hasher.digest('hex'));
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] 82f669c8fde13aef6d6977257588dc4953dfac505428f8fd6b52e19cd96d7ea5
+INFO[0000] 82f669c8fde13aef6d6977257588dc4953dfac505428f8fd6b52e19cd96d7ea5
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/03-hmac- algorithm- secret- data- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/03-hmac- algorithm- secret- data- outputEncoding -.md
new file mode 100644
index 0000000000..ca79dd0a1f
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/03-hmac- algorithm- secret- data- outputEncoding -.md
@@ -0,0 +1,53 @@
+---
+title: 'hmac( algorithm, secret, data, outputEncoding )'
+description: 'Use HMAC to sign input data.'
+excerpt: 'Use HMAC to sign input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/hmac/
+---
+
+
+
+Use [HMAC](https://en.wikipedia.org/wiki/Hash-based_message_authentication_code) to sign a piece of data using a shared secret.
+
+| Parameter | Type | Description |
+| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
+| algorithm | string | The hashing algorithm to use. One of `md4`, `md5`, `sha1`, `sha256`, `sha384`, `sha512`, `sha512_224`, `sha512_256` or `ripemd160`. |
+| secret | string / ArrayBuffer | A shared secret used to sign the data. |
+| data | string / ArrayBuffer | The data to sign. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.hmac('sha256', 'mysecret', 'hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.hmac('sha256', 'mysecret', new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+
+
+```bash
+INFO[0000] 893a72d8cab129e5ba85aea4599fd53f59bfe652cff4098a3780313228d8c20f
+INFO[0000] 893a72d8cab129e5ba85aea4599fd53f59bfe652cff4098a3780313228d8c20f
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/04-md4- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/04-md4- input- outputEncoding -.md
new file mode 100644
index 0000000000..ab1fe21e9f
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/04-md4- input- outputEncoding -.md
@@ -0,0 +1,46 @@
+---
+title: 'md4( input, outputEncoding )'
+description: 'Use MD4 to hash input data.'
+excerpt: 'Use MD4 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/md4/
+---
+
+
+
+Use [md4](https://pkg.go.dev/golang.org/x/crypto/md4) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.md4('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.md4(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] 3363b72840acd5f49f922fef598ee85d
+INFO[0000] 3363b72840acd5f49f922fef598ee85d
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/05-md5- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/05-md5- input- outputEncoding -.md
new file mode 100644
index 0000000000..fa9d188630
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/05-md5- input- outputEncoding -.md
@@ -0,0 +1,46 @@
+---
+title: 'md5( input, outputEncoding )'
+description: 'Use MD5 to hash input data.'
+excerpt: 'Use MD5 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/md5/
+---
+
+
+
+Use [md5](https://golang.org/pkg/crypto/md5/) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.md5('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.md5(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] fc3ff98e8c6a0d3087d515c0473f8677
+INFO[0000] fc3ff98e8c6a0d3087d515c0473f8677
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/06-randomBytes- int -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/06-randomBytes- int -.md
new file mode 100644
index 0000000000..d333b1c2b3
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/06-randomBytes- int -.md
@@ -0,0 +1,36 @@
+---
+title: 'randomBytes( int )'
+description: 'randomBytes.'
+excerpt: 'randomBytes.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/randombytes/
+---
+
+
+
+Return an ArrayBuffer object with a number of cryptographically random bytes. It will either return exactly the amount of bytes requested or will throw an exception if something went wrong.
+
+| Parameter | Type | Description |
+| --------- | ------- | --------------------------------------- |
+| int | integer | The length of the returned ArrayBuffer. |
+
+### Returns
+
+| Type | Description |
+| ----------- | --------------------------------------------------- |
+| ArrayBuffer | An ArrayBuffer with cryptographically random bytes. |
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ const bytes = crypto.randomBytes(42);
+ const view = new Uint8Array(bytes);
+ console.log(view); // 156,71,245,191,56,...
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/07-ripemd160- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/07-ripemd160- input- outputEncoding -.md
new file mode 100644
index 0000000000..aacd651420
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/07-ripemd160- input- outputEncoding -.md
@@ -0,0 +1,47 @@
+---
+title: 'ripemd160( input, outputEncoding )'
+description: 'Use RIPEMD-160 to hash input data.'
+excerpt: 'Use RIPEMD-160 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/ripemd160/
+---
+
+
+
+Use [ripemd160](https://pkg.go.dev/golang.org/x/crypto/ripemd160) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.ripemd160('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.ripemd160(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] dffd03137b3a333d5754813399a5f437acd694e5
+INFO[0000] dffd03137b3a333d5754813399a5f437acd694e5
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/08-sha1- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/08-sha1- input- outputEncoding -.md
new file mode 100644
index 0000000000..5aea396f97
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/08-sha1- input- outputEncoding -.md
@@ -0,0 +1,47 @@
+---
+title: 'sha1( input, outputEncoding )'
+description: 'Use SHA-1 to hash input data.'
+excerpt: 'Use SHA-1 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha1/
+---
+
+
+
+Use [sha1](https://golang.org/pkg/crypto/sha1/) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.sha1('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.sha1(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] 430ce34d020724ed75a196dfc2ad67c77772d169
+INFO[0000] 430ce34d020724ed75a196dfc2ad67c77772d169
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/09-sha256- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/09-sha256- input- outputEncoding -.md
new file mode 100644
index 0000000000..b36f24a98e
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/09-sha256- input- outputEncoding -.md
@@ -0,0 +1,47 @@
+---
+title: 'sha256( input, outputEncoding )'
+description: 'Use SHA-256 to hash input data.'
+excerpt: 'Use SHA-256 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha256/
+---
+
+
+
+Use [sha256](https://golang.org/pkg/crypto/sha256/) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.sha256('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.sha256(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
+INFO[0000] 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/10-sha384- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/10-sha384- input- outputEncoding -.md
new file mode 100644
index 0000000000..3f03941fe0
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/10-sha384- input- outputEncoding -.md
@@ -0,0 +1,47 @@
+---
+title: 'sha384( input, outputEncoding )'
+description: 'Use SHA-384 to hash input data.'
+excerpt: 'Use SHA-384 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha384/
+---
+
+
+
+Use [sha384](https://golang.org/pkg/crypto/sha512/) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.sha384('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.sha384(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] d33d40f7010ce34aa86efd353630309ed5c3d7ffac66d988825cf699f4803ccdf3f033230612f0945332fb580d8af805
+INFO[0000] d33d40f7010ce34aa86efd353630309ed5c3d7ffac66d988825cf699f4803ccdf3f033230612f0945332fb580d8af805
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/11-sha512- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/11-sha512- input- outputEncoding -.md
new file mode 100644
index 0000000000..4f9b545b04
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/11-sha512- input- outputEncoding -.md
@@ -0,0 +1,47 @@
+---
+title: 'sha512( input, outputEncoding )'
+description: 'Use SHA-512 to hash input data.'
+excerpt: 'Use SHA-512 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512/
+---
+
+
+
+Use [sha512](https://golang.org/pkg/crypto/sha512/) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.sha512('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.sha512(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] db9b1cd3262dee37756a09b9064973589847caa8e53d31a9d142ea2701b1b28abd97838bb9a27068ba305dc8d04a45a1fcf079de54d607666996b3cc54f6b67c
+INFO[0000] db9b1cd3262dee37756a09b9064973589847caa8e53d31a9d142ea2701b1b28abd97838bb9a27068ba305dc8d04a45a1fcf079de54d607666996b3cc54f6b67c
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/12-sha512_256- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/12-sha512_256- input- outputEncoding -.md
new file mode 100644
index 0000000000..f71f2a3260
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/12-sha512_256- input- outputEncoding -.md
@@ -0,0 +1,47 @@
+---
+title: 'sha512_256( input, outputEncoding )'
+description: 'Use SHA-512/256 to hash input data.'
+excerpt: 'Use SHA-512/256 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512_256/
+---
+
+
+
+Use [sha512_256](https://golang.org/pkg/crypto/sha512/) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.sha512_256('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.sha512_256(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] 595b5926068b4828fb1c27db21281e31118b8475cb6c3ceeb09be7b685414d5f
+INFO[0000] 595b5926068b4828fb1c27db21281e31118b8475cb6c3ceeb09be7b685414d5f
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/13-sha512_224- input- outputEncoding -.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/13-sha512_224- input- outputEncoding -.md
new file mode 100644
index 0000000000..68e7008a03
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/13-sha512_224- input- outputEncoding -.md
@@ -0,0 +1,47 @@
+---
+title: 'sha512_224( input, outputEncoding )'
+description: 'Use SHA-512/224 to hash input data.'
+excerpt: 'Use SHA-512/224 to hash input data.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/sha512_224/
+---
+
+
+
+Use [sha512_224](https://golang.org/pkg/crypto/sha512/) to hash input data.
+
+| Parameter | Type | Description |
+| -------------- | -------------------- | --------------------------------------------------|
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to hash. |
+| outputEncoding | string | Describes the type of encoding to use for the hash value. Can be "base64", "base64url", "base64rawurl", "hex" or "binary". |
+
+### Returns
+
+| Type | Description |
+| -------------- | ----------- |
+| string / Array | The hash digest as string (for "base64", "base64url", "base64rawurl", "hex" `outputEncoding`) or raw array of integers (for "binary" `outputEncoding`). |
+
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ let hash = crypto.sha512_224('hello world!', 'hex');
+ console.log(hash);
+ const binArray = [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33];
+ hash = crypto.sha512_224(new Uint8Array(binArray).buffer, 'hex');
+ console.log(hash);
+}
+```
+
+
+
+The above script should result in the following being printed during execution:
+
+```bash
+INFO[0000] bc4ed196f7ba1c20f6fb6be1f91edf8293a35b065d6e7d6fd368c890
+INFO[0000] bc4ed196f7ba1c20f6fb6be1f91edf8293a35b065d6e7d6fd368c890
+```
diff --git a/src/data/markdown/docs/02 javascript api/03 k6-crypto/80-Hasher.md b/src/data/markdown/docs/02 javascript api/03 k6-crypto/80-Hasher.md
new file mode 100644
index 0000000000..dd3a729432
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/03 k6-crypto/80-Hasher.md
@@ -0,0 +1,51 @@
+---
+title: 'Hasher'
+description: 'Object returned by crypto.createHash(). It allows adding more data to be hashed and to extract digests along the way.'
+excerpt: 'Object returned by crypto.createHash(). It allows adding more data to be hashed and to extract digests along the way.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-crypto/hasher/
+---
+
+
+
+This object is returned by [crypto.createHash()](/javascript-api/k6-crypto/createhash)
+and allows the user to successively add more string data to be hashed, and to extract digests along the way.
+
+| Name | Type | Description |
+| --------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| Hasher.update(string) | function | Add more data to the string we want to create a hash of. Takes one string argument, which is the new data we want to add. |
+| Hasher.digest(string) | function | Return a digest from the data added (using `update()`) to the Hasher object so far. Takes one string argument, which is the encoding format to return. This can be either "base64", "base64url", "base64rawurl", "hex" or "binary". See the examples below for details. |
+
+### Example
+
+
+
+```javascript
+import crypto from 'k6/crypto';
+
+export default function () {
+ console.log(crypto.sha256('hello world!', 'hex'));
+ const hasher = crypto.createHash('sha256');
+ hasher.update('hello ');
+ hasher.update('world!');
+ console.log(hasher.digest('hex'));
+
+ // Other encodings
+ console.log('base64:', hasher.digest('base64'));
+ console.log('base64url:', hasher.digest('base64url'));
+ console.log('base64rawurl:', hasher.digest('base64rawurl'));
+ console.log('binary:', new Uint8Array(hasher.digest('binary')));
+}
+```
+
+
+
+The above code sample should produce this in its output:
+
+```bash
+INFO[0000] 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
+INFO[0000] 7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
+INFO[0000] base64: dQnlvaDHYtK6x/kNdYtbImP6Acy8VCq1498WO+CObKk=
+INFO[0000] base64url: dQnlvaDHYtK6x_kNdYtbImP6Acy8VCq1498WO-CObKk=
+INFO[0000] base64rawurl: dQnlvaDHYtK6x_kNdYtbImP6Acy8VCq1498WO-CObKk
+INFO[0000] binary: 117,9,229,189,160,199,98,210,186,199,249,13,117,139,91,34,99,250,1,204,188,84,42,181,227,223,22,59,224,142,108,169
+```
diff --git a/src/data/markdown/docs/02 javascript api/04 k6-data.md b/src/data/markdown/docs/02 javascript api/04 k6-data.md
index c6ee1c0588..aedf38e950 100644
--- a/src/data/markdown/docs/02 javascript api/04 k6-data.md
+++ b/src/data/markdown/docs/02 javascript api/04 k6-data.md
@@ -2,8 +2,10 @@
title: "k6/data"
excerpt: "k6 data API"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-data/
-redirect: https://grafana.com/docs/k6/latest/javascript-api/k6-data/
---
The data module provides helpers to work with data.
+| Class/Method | Description |
+| ----- | ----------- |
+| [SharedArray](/javascript-api/k6-data/sharedarray) | read-only array like structure that shares memory between VUs |
diff --git a/src/data/markdown/docs/02 javascript api/04 k6-data/1-SharedArray.md b/src/data/markdown/docs/02 javascript api/04 k6-data/1-SharedArray.md
new file mode 100644
index 0000000000..a32a72d4ac
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/04 k6-data/1-SharedArray.md
@@ -0,0 +1,138 @@
+---
+title: SharedArray
+excerpt: 'SharedArray is an array-like object that shares the underlying memory between VUs.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-data/sharedarray/
+---
+
+`SharedArray` is an array-like object that shares the underlying memory between VUs.
+The function executes only once, and its result is saved in memory once.
+When a script requests an element, k6 gives a _copy_ of that element.
+
+You must construct a `SharedArray` in the [`init` context](/using-k6/test-lifecycle).
+Its constructor takes a name for the `SharedArray` and a function that needs to return an array object itself:
+
+
+```javascript
+import { SharedArray } from 'k6/data';
+
+const data = new SharedArray('some name', function () {
+ const dataArray = [];
+ // more operations
+ return dataArray; // must be an array
+});
+```
+
+The name argument is required.
+VUs are completely separate JS VMs, and k6 needs some way to identify the `SharedArray` that it needs to return.
+You can have multiple `SharedArrays` and even load only some of them for given VUs,
+though this is unlikely to have any performance benefit.
+
+Supported operations on a `SharedArray` include:
+- Getting the number of elements with `length`
+- Getting an element by its index using the normal syntax `array[index]`
+- Using `for-of` loops
+
+In most cases, you should be able to reduce the memory usage of an array data structure by wrapping it in a `SharedArray`.
+Once constructed, a `SharedArray` is read-only, so **you can't use a SharedArray to communicate data between VUs**.
+
+
+
+Attempting to instantiate a `SharedArray` outside of the [init context](/using-k6/test-lifecycle/) results in the exception `new SharedArray must be called in the init context`.
+
+This limitation will eventually be removed, but for now, the implication is that you can use `SharedArray` to populate test data only at the very beginning of your test and not as a result of receiving data from a response (for example).
+
+
+
+
+## Example
+
+
+
+```javascript
+import { SharedArray } from 'k6/data';
+
+const data = new SharedArray('some name', function () {
+ // All heavy work (opening and processing big files for example) should be done inside here.
+ // This way it will happen only once and the result will be shared between all VUs, saving time and memory.
+ const f = JSON.parse(open('./somefile.json'));
+ return f; // f must be an array
+});
+
+export default function () {
+ const element = data[Math.floor(Math.random() * data.length)];
+ // do something with element
+}
+```
+
+
+
+## Performance characteristics
+
+Internally, the current implementation of `SharedArray` keeps the data marshaled as JSON and unmarshals elements only when they are requested.
+
+In general, this operation should be unnoticeable (relative to whatever else you do with the data).
+But, for small data sets, `SharedArray` might perform worse.
+However, this is highly dependent on use case.
+
+To test this, we ran the following script on version v0.31.0 with 100 VUs.
+
+
+
+```javascript
+import { check } from 'k6';
+import http from 'k6/http';
+import { SharedArray } from 'k6/data';
+
+const n = parseInt(__ENV.N);
+function generateArray() {
+ const arr = new Array(n);
+ for (let i = 0; i < n; i++) {
+ arr[i] = { something: 'something else' + i, password: '12314561' };
+ }
+ return arr;
+}
+
+let data;
+if (__ENV.SHARED === 'true') {
+ data = new SharedArray('my data', generateArray);
+} else {
+ data = generateArray();
+}
+
+export default function () {
+ const iterationData = data[Math.floor(Math.random() * data.length)];
+ const res = http.post('https://httpbin.test.k6.io/anything', JSON.stringify(iterationData), {
+ headers: { 'Content-type': 'application/json' },
+ });
+ check(res, { 'status 200': (r) => r.status === 200 });
+}
+```
+
+
+
+As the table shows, performance didn't differ much at lower numbers of data lines:
+up until around 1000 data lines, `SharedArray` shows little benefit in memory usage
+and had a higher upper bound of CPU usage (though not substantially higher).
+
+At 10k lines and above, the memory savings started to heavily carry over to CPU savings as well.
+
+| data lines | shared | wall time | CPU % | MEM usage | http requests |
+| --- | --- | --- | --- | ---- | --- |
+| 100 | true | 2:01:70 | 70-79% | 213-217MB | 92191-98837 |
+| 100 | false | 2:01:80 | 74-75% | 224-232MB | 96851-98643 |
+| 1000 | true | 2:01:60 | 74-79% | 209-216MB | 98251-98806 |
+| 1000 | false | 2:01:90 | 75-77% | 333-339MB | 98069-98951 |
+| 10000 | true | 2:01:70 | 78-79% | 213-217MB | 97953-98735 |
+| 10000 | false | 2:03:00 | 80-83% | 1364-1400MB | 96816-98852 |
+| 100000 | true | 2:02:20 | 78-79% | 238-275MB | 98103-98540 |
+| 100000 | false | 2:14:00 | 120-124% | 8.3-9.1GB | 96003-97802 |
+
+In v0.30.0, the difference in CPU usage at lower numbers was around 10-15%, but it also started to even out at around 10k data lines and was a clear winner at 100k.
+
+The CPU/memory data came from using `/usr/bin/time`. Refer to the [gist with the raw data](https://gist.github.com/MStoykov/1181cfa6f00bc56b90915155f885e2bb).
+
+These numbers are purely illustrative: the performance can be affected by any additional processing of the element retrieved from the `SharedArray`, or if an output is in use, or it gets multiple elements, etc.
+While `SharedArray` has some CPU usage,
+it might turn out to be negligible in a given situation with just 10 elements, or more problematic than the memory usage for a 100k elements.
+So, if in doubt, you should probably run some benchmarks and decide which tradeoffs are more important for your use case.
+
diff --git a/src/data/markdown/docs/02 javascript api/05 k6-encoding.md b/src/data/markdown/docs/02 javascript api/05 k6-encoding.md
index b4c1893001..1cf5ce78de 100644
--- a/src/data/markdown/docs/02 javascript api/05 k6-encoding.md
+++ b/src/data/markdown/docs/02 javascript api/05 k6-encoding.md
@@ -2,7 +2,11 @@
title: "k6/encoding"
excerpt: 'The encoding module provides base64 encoding/decoding as defined by RFC4648.'
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/
-redirect: https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/
---
The encoding module provides [base64](https://en.wikipedia.org/wiki/Base64)
encoding/decoding as defined by [RFC4648](https://tools.ietf.org/html/rfc4648).
+
+| Function | Description |
+| -------- | ----------- |
+| [b64decode(input, [encoding], [format])](/javascript-api/k6-encoding/b64decode/) | Base64 decode a string. |
+| [b64encode(input, [encoding])](/javascript-api/k6-encoding/b64encode/) | Base64 encode a string. |
diff --git a/src/data/markdown/docs/02 javascript api/05 k6-encoding/b64decode- input- -encoding- -format-.md b/src/data/markdown/docs/02 javascript api/05 k6-encoding/b64decode- input- -encoding- -format-.md
new file mode 100644
index 0000000000..09572c5baf
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/05 k6-encoding/b64decode- input- -encoding- -format-.md
@@ -0,0 +1,48 @@
+---
+title: 'b64decode( input, [encoding], [format] )'
+description: 'Base64 decode a string.'
+excerpt: 'Base64 decode a string.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64decode/
+---
+
+Decode the passed base64 encoded `input` string into the unencoded original input in either binary or string formats.
+
+| Parameter | Type | Description |
+| ------------------- | ------ | ------------ |
+| input | string | The string to base64 decode. |
+| encoding (optional) | string | The base64 encoding to use.
Available options are:
- **"std"**: the standard encoding with `=` padding chars and `+` and `/` characters in encoding alphabet. This is the default.
- **"rawstd"**: like `std` but without `=` padding characters.
- **"url"**: URL safe version of `std`, encoding alphabet doesn't contain `+` and `/` characters, but rather `-` and `_` characters.
- **"rawurl"**: like `url` but without `=` padding characters. |
+| format (optional) | string | If `"s"` return the data as a string, otherwise if unspecified an ArrayBuffer object is returned.
+
+### Returns
+
+| Type | Description |
+| -------------------- | ------------------------------------------------- |
+| ArrayBuffer / string | The base64 decoded version of the `input` string in either string or ArrayBuffer format, depending on the `format` parameter. |
+
+### Example
+
+
+
+```javascript
+import { check } from 'k6';
+import encoding from 'k6/encoding';
+
+export default function () {
+ const str = 'hello world';
+ const enc = 'aGVsbG8gd29ybGQ=';
+ const expBin = new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]);
+ check(null, {
+ 'is decoding to string correct': () => encoding.b64decode(enc, 'std', 's') === str,
+ 'is decoding to ArrayBuffer correct': () => {
+ const decBin = new Uint8Array(encoding.b64decode(enc));
+ if (decBin.length != expBin.length) return false;
+ for (let i = 0; i < decBin.length; i++) {
+ if (decBin[i] !== expBin[i]) return false;
+ }
+ return true;
+ },
+ });
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/05 k6-encoding/b64encode- input- -encoding- -.md b/src/data/markdown/docs/02 javascript api/05 k6-encoding/b64encode- input- -encoding- -.md
new file mode 100644
index 0000000000..97b2d8e30f
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/05 k6-encoding/b64encode- input- -encoding- -.md
@@ -0,0 +1,38 @@
+---
+title: 'b64encode( input, [encoding] )'
+description: 'Encode data in base64.'
+excerpt: 'Encode data in base64.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-encoding/b64encode/
+---
+
+| Parameter | Type | Description |
+| ------------------- | ------ | ------------------------------------------------------------------------ |
+| input | string / ArrayBuffer | The input string or `ArrayBuffer` object to base64 encode. |
+| encoding (optional) | string | The base64 encoding to use.
Available options are:
- **"std"**: the standard encoding with `=` padding chars and `+` and `/` characters in encoding alphabet. This is the default.
- **"rawstd"**: like `std` but without `=` padding characters.
- **"url"**: URL safe version of `std`, encoding alphabet doesn't contain `+` and `/` characters, but rather `-` and `_` characters.
- **"rawurl"**: like `url` but without `=` padding characters. |
+
+### Returns
+
+| Type | Description |
+| ------ | ---------------------------------------- |
+| string | The base64 encoding of the `input` data. |
+
+### Example
+
+
+
+```javascript
+import { check } from 'k6';
+import encoding from 'k6/encoding';
+
+export default function () {
+ const str = 'hello world';
+ const enc = 'aGVsbG8gd29ybGQ=';
+ const buf = new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]).buffer;
+ check(null, {
+ 'is encoding string correct': () => encoding.b64encode(str) === enc,
+ 'is encoding ArrayBuffer correct': () => encoding.b64encode(buf) === enc,
+ });
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/06 k6-execution.md b/src/data/markdown/docs/02 javascript api/06 k6-execution.md
index 4126f11f83..0b95bacbfa 100644
--- a/src/data/markdown/docs/02 javascript api/06 k6-execution.md
+++ b/src/data/markdown/docs/02 javascript api/06 k6-execution.md
@@ -2,7 +2,259 @@
title: "k6/execution"
excerpt: "Get information about the current test's execution state."
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-execution/
-redirect: https://grafana.com/docs/k6/latest/javascript-api/k6-execution/
---
`k6/execution` provides the capability to get information about the current test execution state inside the test script. You can read in your script the execution state during the test execution and change your script logic based on the current state.
+
+The `k6/execution` module provides the test execution information with the following properties:
+
+- [instance](#instance)
+- [scenario](#scenario)
+- [test](#test)
+- [vu](#vu)
+
+
+
+```javascript
+import exec from 'k6/execution';
+
+export const options = {
+ scenarios: {
+ myscenario: {
+ // this will be the returned name
+ executor: 'shared-iterations',
+ maxDuration: '30m',
+ },
+ },
+};
+
+export default function () {
+ console.log(exec.scenario.name); // myscenario
+}
+```
+
+
+
+> ℹ️ **Identifiers**
+>
+> All unique identifiers are sequentially generated starting from a base of zero (iterations) or one (VU IDs). In distributed/cloud test runs, the test-wide iteration numbers and VU identifiers are still going to be unique across instances, though there might be gaps in the sequences when, for example, some instances execute faster iterations than others or allocate more VUs mid-test.
+
+
+### instance
+
+The instance object provides information associated with the load generator instance. You can think of it as the current running k6 process, which will likely be a single process if you are running k6 on your local machine. When running a cloud/distributed test with multiple load generator instances, the values of the following properties can differ across instances.
+
+| Property | Type | Description |
+|----------|------|-------------|
+| iterationsInterrupted | integer | The number of prematurely interrupted iterations in the current instance. |
+| iterationsCompleted | integer | The number of completed iterations in the current instance. |
+| vusActive | integer | The number of active VUs. |
+| vusInitialized | integer | The number of currently initialized VUs. |
+| currentTestRunDuration | float | The time passed from the start of the current test run in milliseconds. |
+
+### scenario
+
+Meta information and execution details about the current running [scenario](/using-k6/scenarios).
+
+| Property | Type | Description |
+|----------|------|-------------|
+| name | string | The assigned name of the running scenario. |
+| executor | string | The name of the running [Executor](/using-k6/scenarios/#executors) type. |
+| startTime | integer | The Unix timestamp in milliseconds when the scenario started. |
+| progress | float | Percentage in a 0 to 1 interval of the scenario progress. |
+| iterationInInstance | integer | The unique and zero-based sequential number of the current iteration in the scenario, across the current instance. |
+| iterationInTest | integer | The unique and zero-based sequential number of the current iteration in the scenario. It is unique in all k6 execution modes - in local, cloud and distributed/segmented test runs. However, while every instance will get non-overlapping index values in cloud/distributed tests, they might iterate over them at different speeds, so the values won't be sequential across them. |
+
+
+### test
+
+Control the test execution.
+
+| Property | Type | Description |
+|----------|------|-------------|
+| abort([String]) | function | It aborts the test run with the exit code `108`, and an optional string parameter can provide an error message. Aborting the test will not prevent the `teardown()` execution. |
+| options | Object | It returns an object with all the test options as properties. The options' values are consolidated following the [order of precedence](/using-k6/k6-options/how-to#order-of-precedence) and derived if shortcuts have been used. It returns `null` for properties where the relative option hasn't been defined. |
+
+### vu
+
+Meta information and execution details about the current vu.
+
+| Property | Type | Description |
+|----------|------|-------------|
+| iterationInInstance | integer | The identifier of the iteration in the current instance for this VU. This is only unique for current VU and this instance (if multiple instances). This keeps being aggregated if a given VU is reused between multiple scenarios. |
+| iterationInScenario | integer | The identifier of the iteration in the current scenario for this VU. This is only unique for current VU and scenario it is currently executing. |
+| idInInstance | integer | The identifier of the VU across the instance. Not unique across multiple instances. |
+| idInTest | integer | The globally unique (across the whole test run) identifier of the VU. |
+| metrics.tags | object | The map that gives control over [VU's Tags](/using-k6/tags-and-groups/#tags). The Tags will be included in every metric emitted by the VU and the Tags' state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#tags) below. |
+| metrics.metadata | object | The map that gives control over VU's Metadata. The Metadata will be included in every metric emitted by the VU and the Metadata's state is maintained across different iterations of the same Scenario while the VU exists. Check how to use it in the [example](#metadata) below. |
+
+
+
+Setting a Tag with the same key as a [system tag](/using-k6/k6-options/reference#system-tags) is allowed, but it requires attention to avoid unexpected results. Overwriting system tags will not throw an error, but in most cases will not actually change the value of the emitted metrics as expected. For example, trying to set the `url` tag value will not result in a changed tag value when `http.get()` is called, since the tag value is determined by the HTTP request itself. However, it will add the tag `url` to the metric samples emitted by a `check()` or `metric.add()`, which is probably not the desired behavior. On the other hand, setting the `name` tag will work as expected, since that was already supported for `http.*` methods, for the purposes of the [URL Grouping](/using-k6/http-requests/#url-grouping) feature.
+
+Not all the types are accepted as a tag value: k6 supports strings, numbers and boolean types. Under the hood, the `tags` object handles a Tag as a `String` key-value pair, so all the types will be implicitly converted into a string. If one of the denied types is used (e.g. Object or Array) and the [`throw` option](/using-k6/k6-options/reference/#throw) is set, an exception will be thrown. Otherwise, only a warning is printed and the tag value will be discarded.
+
+
+
+## Examples and use cases
+
+### Getting unique data once
+
+This is a common use case for data parameterization, you can read the [examples](/examples/data-parameterization#retrieving-unique-data) using `scenario.iterationInTest` and `vu.idInTest`.
+
+### Timing operations
+
+The `startTime` property from the `scenario` object can be used to time operations.
+
+
+
+```javascript
+import exec from 'k6/execution';
+
+export default function () {
+ // do some long operations
+ // ...
+ console.log(`step1: scenario ran for ${new Date() - new Date(exec.scenario.startTime)}ms`);
+
+ // some more long operations
+ //...
+ console.log(`step2: scenario ran for ${new Date() - new Date(exec.scenario.startTime)}ms`);
+}
+```
+
+
+
+### Script naming
+The `name` property can be used for executing the logic based on which script is currently running.
+
+> **Tip**:
+> If you need to run [multiple scenarios](/using-k6/scenarios/advanced-examples/#using-multiple-scenarios) in your script you can use `exec` option achieve a similar goal
+
+
+
+```javascript
+import exec from 'k6/execution';
+
+export const options = {
+ scenarios: {
+ 'the-first': {
+ // ...
+ },
+ 'the-second': {
+ // ...
+ },
+ },
+};
+
+export default function () {
+ if (exec.scenario.name === 'the-first') {
+ // do some logic during this scenario
+ } else {
+ // do some other logic in the others
+ }
+}
+```
+
+
+
+### Test Abort
+
+Aborting is possible during initialization:
+
+
+
+```javascript
+import exec from 'k6/execution';
+exec.test.abort();
+```
+
+
+
+As well as inside the `default` function:
+
+
+
+```javascript
+import exec from 'k6/execution';
+
+export default function () {
+ // Note that you can abort with a specific message too
+ exec.test.abort('this is the reason');
+}
+
+export function teardown() {
+ console.log('teardown will still be called after test.abort()');
+}
+```
+
+
+
+### Get test options
+
+Get the consolidated and derived options' values
+
+
+
+```javascript
+import exec from 'k6/execution';
+
+export const options = {
+ stages: [
+ { duration: '5s', target: 100 },
+ { duration: '5s', target: 50 },
+ ],
+};
+
+export default function () {
+ console.log(exec.test.options.paused); // null
+ console.log(exec.test.options.scenarios.default.stages[0].target); // 100
+}
+```
+
+
+
+### Tags
+The `vu.metrics.tags` property can be used for getting or setting [VU's tags](/using-k6/tags-and-groups/#tags).
+
+
+
+```javascript
+import http from 'k6/http';
+import exec from 'k6/execution';
+
+export default function () {
+ exec.vu.metrics.tags['mytag'] = 'value1';
+ exec.vu.metrics.tags['mytag2'] = 2;
+
+ // the metrics these HTTP requests emit will get tagged with `mytag` and `mytag2`:
+ http.batch(['https://test.k6.io', 'https://test-api.k6.io']);
+}
+```
+
+
+
+`vu.tags` (without `metrics`) can also be used, but is deprecated for the more context-specific variant.
+
+
+### Metadata
+The `vu.metrics.metadata` property can be used for getting or setting VU's metadata. It is similar to `tags`, but can be used for high cardinality data. It also can not be used in thresholds and will likely be handled differently by each output.
+
+
+
+```javascript
+import http from 'k6/http';
+import exec from 'k6/execution';
+
+export default function () {
+ exec.vu.metrics.metadata['trace_id'] = 'somecoolide';
+
+ // the metrics these HTTP requests emit will get the metadata `trace_id`:
+ http.batch(['https://test.k6.io', 'https://test-api.k6.io']);
+
+ delete exec.vu.metrics.metadata['trace_id'] // this will unset it
+ // which will make the metrics these requests to not have the metadata `trace_id` set on them.
+ http.batch(['https://test.k6.io', 'https://test-api.k6.io']);
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental.md
index 03f6a25c80..e9b78feb0b 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental.md
@@ -2,5 +2,16 @@
title: "k6/experimental"
excerpt: "k6 experimental APIs"
canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/
-redirect: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/
---
+
+
+
+| Modules | Description |
+| ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
+| [browser](/javascript-api/k6-experimental/browser) | Provides browser-level APIs to interact with browsers and collect frontend performance metrics as part of your k6 tests. |
+| [redis](/javascript-api/k6-experimental/redis/) | Functionality to interact with [Redis](https://redis.io/). |
+| [timers](/javascript-api/k6-experimental/timers/) | `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` |
+| [tracing](/javascript-api/k6-experimental/tracing/) | Support for instrumenting HTTP requests with tracing information. |
+| [webcrypto](/javascript-api/k6-experimental/webcrypto/) | Implements the [WebCrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). |
+| [websockets](/javascript-api/k6-experimental/websockets/) | Implements the browser's [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket). |
+| [grpc](/javascript-api/k6-experimental/grpc/) | Extends `k6/net/grpc` with the streaming capabilities. |
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser.md
new file mode 100644
index 0000000000..3507b28bf7
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser.md
@@ -0,0 +1,258 @@
+---
+title: 'browser'
+excerpt: 'An overview of the browser-level APIs from browser module.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/
+---
+
+
+
+The browser module APIs aim for rough compatibility with the [Playwright API for NodeJS](https://playwright.dev/docs/api/class-playwright).
+
+Note that because k6 does not run in NodeJS, the browser module APIs will slightly differ from their Playwright counterparts.
+
+You can find examples of using [the browser module API](#browser-module-api) in our [getting started guide](/using-k6-browser).
+
+
+
+To work with the browser module, make sure you are using the latest [k6 version](https://github.com/grafana/k6/releases).
+
+
+
+## Properties
+
+The table below lists the properties you can import from the browser module (`'k6/experimental/browser'`).
+
+| Property | Description |
+|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| browser | The browser module API is the entry point for all your tests. See the [example](#example) and the [API](#browser-module-api) below. |
+| devices | Returns predefined emulation settings for many end-user devices that can be used to simulate browser behavior on a mobile device. See the [devices example](#devices-example) below. |
+
+
+## Browser Module API
+
+The browser module is the entry point for all your tests, and it is what interacts with the actual web browser via [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol/) (CDP). It manages:
+- [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) which is where you can set a variety of attributes to control the behavior of pages;
+- and [Page](/javascript-api/k6-experimental/browser/page/) which is where your rendered site is displayed.
+
+| Method | Description |
+|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
+| [browser.context()](/javascript-api/k6-experimental/browser/context) | Returns the current [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/). |
+| [browser.isConnected](/javascript-api/k6-experimental/browser/isconnected)
| Indicates whether the [CDP](https://chromedevtools.github.io/devtools-protocol/) connection to the browser process is active or not. |
+| [browser.newContext([options])](/javascript-api/k6-experimental/browser/newcontext/)
| Creates and returns a new [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/). |
+| [browser.newPage([options])](/javascript-api/k6-experimental/browser/newpage)
| Creates a new [Page](/javascript-api/k6-experimental/browser/page/) in a new [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) and returns the page. Pages that have been opened ought to be closed using [`Page.close`](/javascript-api/k6-experimental/browser/page/close/). Pages left open could potentially distort the results of Web Vital metrics. |
+| [browser.version()](/javascript-api/k6-experimental/browser/version/) | Returns the browser application's version. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+
+ try {
+ await page.goto('https://test.k6.io/');
+ } finally {
+ page.close();
+ }
+}
+```
+
+
+
+Then, you can run the test with this command. Also, see the [browser module options](/javascript-api/k6-experimental/browser/#browser-module-options) for customizing the browser module's behavior using environment variables.
+
+
+
+```bash
+$ k6 run script.js
+```
+
+```bash
+# WARNING!
+# The grafana/k6:master-with-browser image launches a Chrome browser by setting the
+# 'no-sandbox' argument. Only use it with trustworthy websites.
+#
+# As an alternative, you can use a Docker SECCOMP profile instead, and overwrite the
+# Chrome arguments to not use 'no-sandbox' such as:
+# docker container run --rm -i -e K6_BROWSER_ARGS='' --security-opt seccomp=$(pwd)/chrome.json grafana/k6:master-with-browser run - k6 run script.js
+```
+
+```bash
+PS C:\k6> k6 run script.js
+```
+
+
+
+
+
+
+## Browser-level APIs
+
+| k6 Class | Description |
+|-------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/)
| Enables independent browser sessions with separate [Page](/javascript-api/k6-experimental/browser/page/)s, cache, and cookies. |
+| [ElementHandle](/javascript-api/k6-experimental/browser/elementhandle/)
| Represents an in-page DOM element. |
+| [Frame](/javascript-api/k6-experimental/browser/frame/)
| Access and interact with the [`Page`](/javascript-api/k6-experimental/browser/page/).'s `Frame`s. |
+| [JSHandle](/javascript-api/k6-experimental/browser/jshandle) | Represents an in-page JavaScript object. |
+| [Keyboard](/javascript-api/k6-experimental/browser/keyboard/) | Used to simulate the keyboard interactions with the associated [`Page`](/javascript-api/k6-experimental/browser/page/). |
+| [Locator](/javascript-api/k6-experimental/browser/locator/) | The Locator API makes it easier to work with dynamically changing elements. |
+| [Mouse](/javascript-api/k6-experimental/browser/mouse/) | Used to simulate the mouse interactions with the associated [`Page`](/javascript-api/k6-experimental/browser/page/). |
+| [Page](/javascript-api/k6-experimental/browser/page/)
| Provides methods to interact with a single tab in a browser. |
+| [Request](/javascript-api/k6-experimental/browser/request/)
| Used to keep track of the request the [`Page`](/javascript-api/k6-experimental/browser/page/) makes. |
+| [Response](/javascript-api/k6-experimental/browser/response/)
| Represents the response received by the [`Page`](/javascript-api/k6-experimental/browser/page/). |
+| [Touchscreen](/javascript-api/k6-experimental/browser/touchscreen/) | Used to simulate touch interactions with the associated [`Page`](/javascript-api/k6-experimental/browser/page/). |
+| [Worker](/javascript-api/k6-experimental/browser/worker/) | Represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). |
+
+
+## Browser Module Options
+
+You can customize the behavior of the browser module by providing browser options as environment variables.
+
+| Environment Variable | Description |
+| -------------------- | ----------- |
+| K6_BROWSER_ARGS | Extra command line arguments to include when launching browser process. See [this link](https://peter.sh/experiments/chromium-command-line-switches/) for a list of Chromium arguments. Note that arguments should not start with `--` (see the [example](#example)). |
+| K6_BROWSER_DEBUG | All CDP messages and internal fine grained logs will be logged if set to `true`. |
+| K6_BROWSER_EXECUTABLE_PATH | Override search for browser executable in favor of specified absolute path. |
+| K6_BROWSER_HEADLESS | Show browser GUI or not. `true` by default. |
+| K6_BROWSER_IGNORE_DEFAULT_ARGS | Ignore any of the [default arguments](#default-arguments) included when launching a browser process. |
+| K6_BROWSER_TIMEOUT | Default timeout to use for various actions and navigation. `'30s'` if not set. |
+
+The following command passes the [browser module options](#browser-module-options) as environment variables to launch a headful browser with custom arguments.
+
+
+
+```bash
+$ K6_BROWSER_HEADLESS=false K6_BROWSER_ARGS='show-property-changed-rects' k6 run script.js
+```
+```bash
+# WARNING!
+# The grafana/k6:master-with-browser image launches a Chrome browser by setting the
+# 'no-sandbox' argument. Only use it with trustworthy websites.
+#
+# As an alternative, you can use a Docker SECCOMP profile instead, and overwrite the
+# Chrome arguments to not use 'no-sandbox' such as:
+# docker container run --rm -i -e K6_BROWSER_ARGS='' --security-opt seccomp=$(pwd)/chrome.json grafana/k6:master-with-browser run - set "K6_BROWSER_HEADLESS=false" && set "K6_BROWSER_ARGS='show-property-changed-rects' " && k6 run script.js
+```
+
+```bash
+PS C:\k6> $env:K6_BROWSER_HEADLESS="false" ; $env:K6_BROWSER_ARGS='show-property-changed-rects' ; k6 run script.js
+```
+
+
+
+
+## Default arguments
+
+List of default arguments included when launching the browser process. You can pass one or more of the arguments to the `K6_BROWSER_IGNORE_DEFAULT_ARGS` environment variable when starting a test for the ones you want to ignore.
+
+
+
+The starting '--' have been omitted from the argument names in these lists.
+
+
+
+| Argument | Value | Description |
+|----------|--------|--------------------------------------------------------|
+| disable-background-networking | `true` | Disables several subsystems which run network requests in the background. This is used during network performance testing to avoid measurement noise. |
+| enable-features | NetworkService,
NetworkServiceInProcess | Comma-separated list of feature names to enable. |
+| disable-background-timer-throttling | `true` | Disables task throttling of timer tasks from background pages. |
+| disable-backgrounding-occluded-windows | `true` | Disables backgrounding renders for occluded windows. Done for tests to avoid nondeterministic behavior. |
+| disable-breakpad | `true` | Disables the crash reporting. |
+| disable-component-extensions
-with-background-pages | `true` | Disables default component extensions with background pages. Useful for performance tests where these pages may interfere with results. |
+| disable-default-apps | `true` | Disables the installation of default apps on the first run. This is used during automated testing. |
+| disable-dev-shm-usage | `true` | The /dev/shm partition is too small in certain VM environments, causing Chrome to fail or crash. This flag provides a work-around for this issue (a temporary directory will always be used to create anonymous shared memory files). |
+| disable-extensions | `true` | Disables extensions. |
+| disable-features | ImprovedCookieControls,
LazyFrameLoading,
GlobalMediaControls,
DestroyProfileOnBrowserClose,
MediaRouter,
AcceptCHFrame | Comma-separated list of feature names to disable. |
+| disable-hang-monitor | `true` | Suppresses hang monitor dialogs in renderer processes. This may allow slow unload handlers on a page to prevent the tab from closing, but the Task Manager can be used to terminate the offending process in this case. |
+| disable-ipc-flooding-protection | `true` | Disables the IPC flooding protection. It is activated by default. Some javascript functions can be used to flood the browser process with IPC. This protection limits the rate at which they can be used. |
+| disable-popup-blocking | `true` | Disables pop-up blocking. |
+| disable-prompt-on-repost | `true` | Usually, when the user attempts to navigate to a page that was the result of a post request, the browser prompts to make sure that's the intention of the user. This switch may be used to disable that check during automated testing. |
+| disable-renderer-backgrounding | `true` | Prevents renderer process backgrounding when set. |
+| force-color-profile | `srgb` | Forces all monitors to be treated as though they have the specified color profile. Accepted values are "srgb" and "generic-rgb" (currently used by Mac layout tests) and "color-spin-gamma24" (used by layout tests). |
+| metrics-recording-only | `true` | Enables the recording of metrics reports but disables reporting. This executes all the code that a normal client would use for reporting, except the report is dropped rather than sent to the server. This is useful for finding issues in the metrics code during UI and performance tests. |
+| no-first-run | `true` | Skips the "First Run" tasks, whether or not it's the first run, and the "What's New" page. This does not drop the "First Run" sentinel and thus doesn't prevent "First Run" from occurring the next time Chromium is launched without this flag. It also does not update the last "What's New" milestone, so it does not prevent "What's New" from occurring the next time Chromium is launched without this flag. |
+| enable-automation | `true` | Enables indication that the browser is controlled by automation. |
+| password-store | `basic` | Specifies which encryption storage backend to use. The possible values are kwallet, kwallet5, gnome, gnome-keyring, gnome-libsecret, and basic. Any other value will lead to Chromium detecting the best backend automatically. |
+| use-mock-keychain | `true` | Uses mock keychain on Mac to prevent the blocking permissions dialog about: "Chrome wants to use your confidential information stored in your keychain." |
+| no-service-autorun | `true` | Disables the service process from adding itself as an autorun process. This does not delete existing autorun registrations, it just prevents the service from registering a new one. |
+| no-startup-window | `true` | Does not automatically open a browser window on startup (used when launching Chrome for the purpose of hosting background apps). |
+| no-default-browser-check | `true` | Disables the default browser check. Useful for UI/browser tests where we want to avoid having the default browser info-bar displayed. |
+| headless | `true`/`false` | Run in headless mode, i.e., without a UI or display server dependencies. Set by `K6_BROWSER_HEADLESS` environment variable (default true). |
+| window-size | `800,600` | Sets the initial window size. Provided as string in the format "800,600". |
+
+Additionally if headless mode is set to `true` in [browser options](/javascript-api/k6-experimental/browser#browser_options), the following arguments are also set:
+
+| Argument | Value | Description |
+|------------|--------|--------------------------------------------------------|
+| hide-scrollbars | `true` | Prevents creating scrollbars for web content. Useful for taking consistent screenshots. |
+| mute-audio | `true` | Mutes audio sent to the audio device so it is not audible during automated testing. |
+| blink-settings | primaryHoverType=2,availableHoverTypes=2,
primaryPointerType=4,availablePointerTypes=4 | Sets blink settings. Format is
[=],[=],... The names are declared in [settings.json5](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/frame/settings.json5) from chromium project. For boolean type, use "true", "false", or omit '=' part to set to true. For enum type, use the int value of the enum value. |
+
+## Devices Example
+
+To emulate the browser behaviour on a mobile device and approximately measure the browser performance, you can import `devices` from `k6/experimental/browser`.
+
+
+
+```javascript
+import { browser, devices } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const iphoneX = devices['iPhone X'];
+ const context = browser.newContext(iphoneX);
+ const page = context.newPage();
+
+ try {
+ await page.goto('https://test.k6.io/');
+ } finally {
+ page.close();
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext.md
new file mode 100644
index 0000000000..1694806f13
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext.md
@@ -0,0 +1,28 @@
+---
+title: "BrowserContext"
+excerpt: "Browser module: BrowserContext Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/
+---
+
+`BrowserContext`s provide a way to operate multiple independent sessions, with separate pages, cache, and cookies. A default `BrowserContext` is created when a browser is launched.
+
+The [browser module API](/javascript-api/k6-experimental/browser#browser-module-api) is used to create a new `BrowserContext`.
+
+If a [page](/javascript-api/k6-experimental/browser/page/) opens another page, e.g. with a `window.open` call, the popup will belong to the parent page's `BrowserContext`.
+
+
+| Method | Description |
+| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
+| [BrowserContext.addCookies()](/javascript-api/k6-experimental/browser/browsercontext/addcookies/) | Adds [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) into the `BrowserContext`. |
+| [BrowserContext.clearCookies()](/javascript-api/k6-experimental/browser/browsercontext/clearcookies/) | Clear the `BrowserContext`'s [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie). |
+| [BrowserContext.clearPermissions()](/javascript-api/k6-experimental/browser/browsercontext/clearpermissions) | Clears all permission overrides for the `BrowserContext`. |
+| [BrowserContext.cookies()](/javascript-api/k6-experimental/browser/browsercontext/cookies) | Returns a list of [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) from the `BrowserContext`. |
+| [BrowserContext.close()](/javascript-api/k6-experimental/browser/browsercontext/close) | Close the `BrowserContext` and all its [page](/javascript-api/k6-experimental/browser/page/)s. |
+| [BrowserContext.grantPermissions(permissions[, options])](/javascript-api/k6-experimental/browser/browsercontext/grantpermissions) | Grants specified permissions to the `BrowserContext`. |
+| [BrowserContext.newPage()](/javascript-api/k6-experimental/browser/browsercontext/newpage) | Uses the `BrowserContext` to create a new [Page](/javascript-api/k6-experimental/browser/page/) and returns it. |
+| [BrowserContext.pages()](/javascript-api/k6-experimental/browser/browsercontext/pages) | Returns a list of [page](/javascript-api/k6-experimental/browser/page/)s that belongs to the `BrowserContext`. |
+| [BrowserContext.setDefaultNavigationTimeout(timeout)](/javascript-api/k6-experimental/browser/browsercontext/setdefaultnavigationtimeout) | Sets the default navigation timeout in milliseconds. |
+| [BrowserContext.setDefaultTimeout(timeout)](/javascript-api/k6-experimental/browser/browsercontext/setdefaulttimeout) | Sets the default maximum timeout for all methods accepting a timeout option in milliseconds. |
+| [BrowserContext.setGeolocation(geolocation)](/javascript-api/k6-experimental/browser/browsercontext/setgeolocation) | Sets the `BrowserContext`'s geolocation. |
+| [BrowserContext.setOffline(offline)](/javascript-api/k6-experimental/browser/browsercontext/setoffline) | Toggles the `BrowserContext`'s connectivity on/off. |
+| [BrowserContext.waitForEvent(event[, optionsOrPredicate])](/javascript-api/k6-experimental/browser/browsercontext/waitforevent) | Waits for the event to fire and passes its value into the predicate function. |
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/addCookies.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/addCookies.md
new file mode 100644
index 0000000000..186d471b53
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/addCookies.md
@@ -0,0 +1,89 @@
+---
+title: 'addCookies()'
+excerpt: 'Clears context cookies.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/addcookies/
+---
+
+Adds a list of [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) into the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/cookie). All pages within this [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/cookie) will have these [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) set.
+
+
+
+If a [cookie](/javascript-api/k6-experimental/browser/browsercontext/cookie)'s `url` property is not provided, both `domain` and `path` properties must be specified.
+
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const context = browser.newContext();
+ const page = context.newPage();
+
+ try {
+ const unixTimeSinceEpoch = Math.round(new Date() / 1000);
+ const day = 60*60*24;
+ const dayAfter = unixTimeSinceEpoch+day;
+ const dayBefore = unixTimeSinceEpoch-day;
+
+ context.addCookies([
+ // this cookie expires at the end of the session
+ {
+ name: 'testcookie',
+ value: '1',
+ sameSite: 'Strict',
+ domain: 'httpbin.org',
+ path: '/',
+ httpOnly: true,
+ secure: true,
+ },
+ // this cookie expires in a day
+ {
+ name: 'testcookie2',
+ value: '2',
+ sameSite: 'Lax',
+ domain: 'httpbin.org',
+ path: '/',
+ expires: dayAfter,
+ },
+ // this cookie expires in the past, so it will be removed.
+ {
+ name: 'testcookie3',
+ value: '3',
+ sameSite: 'Lax',
+ domain: 'httpbin.org',
+ path: '/',
+ expires: dayBefore
+ }
+ ]);
+
+ const response = await page.goto('https://httpbin.org/cookies', {
+ waitUntil: 'networkidle',
+ });
+ console.log(response.json());
+ // prints:
+ // {"cookies":{"testcookie":"1","testcookie2":"2"}}
+ } finally {
+ page.close();
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/clearCookies.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/clearCookies.md
new file mode 100644
index 0000000000..e87efb6b0b
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/clearCookies.md
@@ -0,0 +1,41 @@
+---
+title: 'clearCookies()'
+excerpt: 'Clears context cookies.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/clearcookies/
+---
+
+Clears the `BrowserContext`'s cookies.
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const context = browser.newContext();
+ const page = context.newPage();
+
+ await page.goto('https://httpbin.org/cookies/set?testcookie=testcookievalue');
+ console.log(context.cookies().length); // prints: 1
+
+ context.clearCookies();
+ console.log(context.cookies().length); // prints: 0
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/clearPermissions.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/clearPermissions.md
new file mode 100644
index 0000000000..5d1f1f1bfe
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/clearPermissions.md
@@ -0,0 +1,45 @@
+---
+title: 'clearPermissions()'
+excerpt: 'Clears all permission overrides for the BrowserContext.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/clearpermissions/
+---
+
+
+
+This feature has known issues.
+For details, refer to [issue #443](https://github.com/grafana/xk6-browser/issues/443).
+
+
+
+Clears all permission overrides for the `BrowserContext`.
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default function () {
+ const context = browser.newContext();
+ context.grantPermissions(['clipboard-read']);
+ // do stuff ...
+ context.clearPermissions();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/close.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/close.md
new file mode 100644
index 0000000000..4b6501d69d
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/close.md
@@ -0,0 +1,38 @@
+---
+title: 'close()'
+excerpt: 'Close the BrowserContext and all its pages.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/close/
+---
+
+Close the `BrowserContext` and all its [page](/javascript-api/k6-experimental/browser/page/)s. The `BrowserContext` is unusable after this call and a new one must be created. This is typically called to cleanup before ending the test.
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default function () {
+ const context = browser.newContext();
+ context.newPage();
+
+ context.close();
+}
+```
+
+
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookie.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookie.md
new file mode 100644
index 0000000000..609f455782
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookie.md
@@ -0,0 +1,21 @@
+---
+title: "Cookie"
+excerpt: "Browser module: Cookie Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/cookie/
+---
+
+Cookie class represents a cookie in the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext).
+
+See the [HTTP Cookies documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) on the Mozilla website for more details about cookies.
+
+| Property | Type | Default | Description |
+| -------- | ------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| name | string | `""` | The cookie's name. Required. |
+| value | string | `""` | The cookie's value. Required. |
+| domain | string | `""` | The cookie's domain. |
+| path | string | `'/'` | The cookie's path. |
+| url | string | `""` | The cookie's URL. |
+| expires | number | `-1` | The cookie's expiration date as the number of seconds since the UNIX epoch. `-1` means a session cookie. |
+| httpOnly | bool | `false` | A cookie is inaccessible to the JavaScript [document.cookie](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie) API when this property is `true`. |
+| secure | bool | `false` | The cookie's secure flag. |
+| sameSite | string | `'Lax'` | The cookie's same site flag. It can be one of `'Strict'`, `'Lax'`, and `'None'`. |
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookies.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookies.md
new file mode 100644
index 0000000000..526084370d
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/cookies.md
@@ -0,0 +1,81 @@
+---
+title: 'cookies([urls])'
+excerpt: 'Retrieves context cookies.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/cookies/
+---
+
+Returns a list of [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) from the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext) filtered by the provided `urls`. If no `urls` are provided, all cookies are returned.
+
+| Parameter | Type | Description |
+|----------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| urls | array | A string array of URLs to filter the [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) in the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext). |
+
+### Returns
+
+| Type | Description |
+| ---- | ----------- |
+| array | A list of [cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie). |
+
+
+
+[Cookies](/javascript-api/k6-experimental/browser/browsercontext/cookie) can be added with [BrowserContext.addCookies](/javascript-api/k6-experimental/browser/browsercontext/addcookies/).
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ ui: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+};
+
+export default async function () {
+ const context = browser.newContext();
+ const page = context.newPage();
+
+ try {
+ // get cookies from the browser context
+ let cookies = context.cookies();
+ console.log("initial cookies length:", cookies.length); // prints 0
+
+ // let's add more cookies to filter by urls
+ context.addCookies([
+ { name: 'foo', value: 'foovalue', sameSite: 'Strict', url: 'http://foo.com' },
+ { name: 'bar', value: 'barvalue', sameSite: 'Lax', url: 'https://bar.com' },
+ { name: 'baz', value: 'bazvalue', sameSite: 'Lax', url: 'https://baz.com' }
+ ]);
+
+ // get all cookies
+ cookies = context.cookies();
+ console.log("filtered cookies length:", cookies.length); // prints 3
+
+ // get cookies filtered by urls
+ cookies = context.cookies('http://foo.com', 'https://baz.com');
+ console.log("filtered cookies length:", cookies.length); // prints 2
+
+ // the first filtered cookie
+ console.log("1st cookie's name :", cookies[0].name); // prints foo
+ console.log("1st cookie's value:", cookies[0].value); // prints foovalue
+ // the first filtered cookie
+ console.log("2nd cookie's name :", cookies[1].name); // prints baz
+ console.log("2nd cookie's value:", cookies[1].value); // prints bazvalue
+ } finally {
+ page.close();
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/grantPermissions.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/grantPermissions.md
new file mode 100644
index 0000000000..df175440aa
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/grantPermissions.md
@@ -0,0 +1,48 @@
+---
+title: 'grantPermissions(permissions[, options])'
+excerpt: 'Grants specified permissions to the BrowserContext.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/grantpermissions/
+---
+
+Grants specified permissions to the `BrowserContext`. Only grants corresponding permissions to the given origin if specified.
+
+
+
+| Parameter | Type | Description |
+|----------------|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| permissions | array | A string array of permissions to grant. A permission can be one of the following values: `'geolocation'`, `'midi'`, `'midi-sysex'` (system-exclusive midi), `'notifications'`, `'camera'`, `'microphone'`, `'background-sync'`, `'ambient-light-sensor'`, `'accelerometer'`, `'gyroscope'`, `'magnetometer'`, `'accessibility-events'`, `'clipboard-read'`, `'clipboard-write'`, `'payment-handler'`. |
+| options | object | Optional. |
+| options.origin | string | The [origin](https://developer.mozilla.org/en-US/docs/Glossary/Origin) to grant permissions to, e.g. `'https://example.com'`. |
+
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default function () {
+ const context = browser.newContext();
+ context.grantPermissions(['clipboard-read', 'clipboard-write'], {
+ origin: 'https://example.com/',
+ });
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/newPage.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/newPage.md
new file mode 100644
index 0000000000..bd44d02045
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/newPage.md
@@ -0,0 +1,35 @@
+---
+title: 'newPage()'
+excerpt: 'Creates a new page inside this BrowserContext.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/newpage/
+---
+
+Uses the `BrowserContext` to create a new [Page](/javascript-api/k6-experimental/browser/page/) and returns it.
+
+
+### Returns
+
+| Type | Description |
+| ------ | ------------------------------------------------------- |
+| object | A new [Page](/javascript-api/k6-experimental/browser/page/) object. |
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export default async function () {
+ const page = browser.newPage();
+
+ try {
+ await page.goto('https://test.k6.io/browser.php');
+ } finally {
+ page.close();
+ }
+}
+```
+
+
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/pages.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/pages.md
new file mode 100644
index 0000000000..4e432931a5
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/pages.md
@@ -0,0 +1,53 @@
+---
+title: 'pages()'
+excerpt: 'Returns a list of pages inside this BrowserContext.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/pages/
+---
+
+
+
+This feature has **known issues**. For details, refer to
+[#444](https://github.com/grafana/xk6-browser/issues/444).
+
+
+
+Returns all open [Page](/javascript-api/k6-experimental/browser/page/)s in the `BrowserContext`.
+
+
+### Returns
+
+| Type | Description |
+| ------ | --------------- |
+| array | All open pages. |
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default function () {
+ const context = browser.newContext();
+ context.newPage();
+ const pages = context.pages();
+ console.log(pages.length); // 1
+ context.close();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setDefaultNavigationTimeout.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setDefaultNavigationTimeout.md
new file mode 100644
index 0000000000..52a95c9ff3
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setDefaultNavigationTimeout.md
@@ -0,0 +1,47 @@
+---
+title: 'setDefaultNavigationTimeout(timeout)'
+excerpt: 'Sets the default navigation timeout in milliseconds.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout/
+---
+
+Sets the default maximum navigation timeout for [Page.goto()](https://playwright.dev/docs/api/class-page#page-goto).
+
+| Parameter | Type | Default | Description |
+|-----------|--------|--------------------------|------------------------------|
+| timeout | number | Dependent on the action. | The timeout in milliseconds. |
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const context = browser.newContext();
+ const page = context.newPage();
+ context.setDefaultNavigationTimeout(1000); // 1s
+
+ try {
+ await page.goto('https://httpbin.test.k6.io/delay/5');
+ } finally {
+ page.close();
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setDefaultTimeout.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setDefaultTimeout.md
new file mode 100644
index 0000000000..11ae7c6dec
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setDefaultTimeout.md
@@ -0,0 +1,42 @@
+---
+title: 'setDefaultTimeout(timeout)'
+excerpt: 'Sets the default timeout in milliseconds.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/setdefaulttimeout/
+---
+
+Sets the default maximum timeout for all methods accepting a `timeout` option in milliseconds.
+
+| Parameter | Type | Default | Description |
+|-----------|--------|--------------------------|------------------------------|
+| timeout | number | Dependent on the action. | The timeout in milliseconds. |
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const context = browser.newContext();
+ context.setDefaultTimeout(1000); // 1s
+ const page = context.newPage();
+ await page.click('h2'); // times out
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setGeolocation.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setGeolocation.md
new file mode 100644
index 0000000000..929e9e4c06
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setGeolocation.md
@@ -0,0 +1,53 @@
+---
+title: 'setGeolocation(geolocation)'
+excerpt: "Sets the BrowserContext's geolocation."
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/setgeolocation/
+---
+
+
+
+This feature has **known issues**. For details, refer to
+[#435](https://github.com/grafana/xk6-browser/issues/435).
+
+
+
+Sets the context's geolocation.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------------|--------|---------|---------------------------------------|
+| geolocation | object | `null` | |
+| geolocation.latitude | number | `0` | Latitude between -90 and 90. |
+| geolocation.longitude | number | `0` | Latitude between -180 and 180. |
+| geolocation.accuracy | number | `0` | Optional non-negative accuracy value. |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default function () {
+ const context = browser.newContext();
+ context.setGeolocation({latitude: 59.95, longitude: 30.31667});
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setOffline.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setOffline.md
new file mode 100644
index 0000000000..e625c967f2
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/setOffline.md
@@ -0,0 +1,50 @@
+---
+title: 'setOffline(offline)'
+excerpt: "Toggles the BrowserContext's connectivity on/off."
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/setoffline/
+---
+
+Toggles the `BrowserContext`'s connectivity on/off.
+
+| Parameter | Type | Default | Description |
+|-----------|---------|---------|---------------------------------------------------------------------------------------------|
+| offline | boolean | `false` | Whether to emulate the `BrowserContext` being disconnected (`true`) or connected (`false`). |
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const context = browser.newContext();
+
+ context.setOffline(true);
+
+ const page = context.newPage();
+
+ try {
+ // Will not be able to load the page
+ await page.goto('https://test.k6.io/browser.php');
+ } finally {
+ page.close();
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/waitForEvent.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/waitForEvent.md
new file mode 100644
index 0000000000..09f16972e2
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/waitForEvent.md
@@ -0,0 +1,34 @@
+---
+title: 'waitForEvent(event[, optionsOrPredicate])'
+excerpt: 'Waits for event to fire and passes its value into the predicate function.'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/browsercontext/waitforevent/
+---
+
+
+
+This method is a work in progress.
+It requires async functionality and returning a `Promise` to be useful in scripts.
+Refer to #447 for details.
+
+Consider using the sync methods `Page.waitForNavigation()` and `Page.waitForSelector()` instead.
+
+
+
+Waits for the event to fire and passes its value into the predicate function. Returns the event data value when the predicate returns `true`.
+
+
+
+| Parameter | Type | Default | Description |
+|------------------------------|------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------|
+| event | string | `null` | Name of event to wait for. **NOTE**: Currently this argument is disregarded, and `waitForEvent` will always wait for `'close'` or `'page'` events. |
+| optionsOrPredicate | function\|object | `null` | Optional. If it's a function, the `'page'` event data will be passed to it and it must return `true` to continue. |
+| optionsOrPredicate.predicate | function | `null` | Function that will be called when the `'page'` event is emitted. The event data will be passed to it and it must return `true` to continue. |
+| optionsOrPredicate.timeout | number | `30000` | Maximum time to wait in milliseconds. Pass `0` to disable timeout. |
+
+
+
+### Returns
+
+| Type | Description |
+| ------ | ------------------------------------------------ |
+| object | [Page](/javascript-api/k6-experimental/browser/page/) object |
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03-console-message.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03-console-message.md
new file mode 100644
index 0000000000..b9ed89d940
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03-console-message.md
@@ -0,0 +1,16 @@
+---
+title: "ConsoleMessage"
+excerpt: "Browser module: ConsoleMessage Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/consolemessage/
+---
+
+
+
+## Supported APIs
+
+| Method | Playwright Relevant Distinctions |
+| - | - |
+| consoleMessage.args() | - |
+| consoleMessage.page() | - |
+| consoleMessage.text() | - |
+| consoleMessage.type() | - |
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/04-element-handle.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/04-element-handle.md
new file mode 100644
index 0000000000..5b68e4f6d2
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/04-element-handle.md
@@ -0,0 +1,144 @@
+---
+title: "ElementHandle"
+excerpt: "Browser module: ElementHandle Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/elementhandle/
+---
+
+
+
+## Supported APIs
+
+| Method | Playwright Relevant Distinctions |
+| - | - |
+| elementHandle.$(selector) | - |
+| elementHandle.$$(selector) | - |
+| elementHandle.boundingBox() | - |
+| elementHandle.check([options]) | - |
+| elementHandle.click([options]) | - |
+| elementHandle.contentFrame() | - |
+| elementHandle.dblclick([options]) | - |
+| elementHandle.dispatchEvent(type[, eventInit]) | - |
+| elementHandle.fill(value[, options]) | - |
+| elementHandle.focus() | - |
+| elementHandle.getAttribute() | - |
+| elementHandle.hover([options]) | - |
+| elementHandle.innerHTML() | - |
+| elementHandle.innerText() | - |
+| elementHandle.inputValue([options]) | - |
+| elementHandle.isChecked() | - |
+| elementHandle.isDisabled() | - |
+| elementHandle.isEditable() | - |
+| elementHandle.isEnabled() | - |
+| elementHandle.isHidden() | - |
+| elementHandle.isVisible() | - |
+| elementHandle.ownerFrame() | - |
+| elementHandle.press(key[, options]) | - |
+| elementHandle.screenshot([options]) | - |
+| elementHandle.scrollIntoViewIfNeeded([options]) | - |
+| elementHandle.selectOptions(values[, options]) | - |
+| elementHandle.selectText([options]) | - |
+| elementHandle.setChecked(checked[, options]) | - |
+| elementHandle.tap([options]) | - |
+| elementHandle.textContent() | - |
+| elementHandle.type(text[, options]) | - |
+| elementHandle.uncheck([options]) | - |
+| elementHandle.waitForElementState(state[, options]) | - |
+| elementHandle.waitForSelector(selector[, options]) | - |
+
+## Examples
+
+
+
+```javascript
+import { check } from 'k6';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+
+ // Goto front page, find login link and click it
+ try {
+ await page.goto('https://test.k6.io/');
+ const messagesLink = page.locator('a[href="/my_messages.php"]');
+
+ await Promise.all([page.waitForNavigation(), messagesLink.click()]);
+ // Enter login credentials and login
+ page.locator('input[name="login"]').type('admin');
+ page.locator('input[name="password"]').type('123');
+
+ const submitButton = page.locator('input[type="submit"]');
+
+ await Promise.all([page.waitForNavigation(), submitButton.click()]);
+ check(page, {
+ 'header': p => p.locator('h2').textContent() == 'Welcome, admin!',
+ });
+ } finally {
+ page.close();
+ }
+}
+```
+
+
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+import { check } from 'k6';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default function () {
+ const page = browser.newPage();
+
+ // Inject page content
+ page.setContent(`
+ Hello world
+
+ Edit me
+
+
+
+
+ `);
+
+ // Check state
+ check(page, {
+ visible: (p) => p.$('.visible').isVisible(),
+ hidden: (p) => p.$('.hidden').isHidden(),
+ editable: (p) => p.$('.editable').isEditable(),
+ enabled: (p) => p.$('.enabled').isEnabled(),
+ disabled: (p) => p.$('.disabled').isDisabled(),
+ checked: (p) => p.$('.checked').isChecked(),
+ unchecked: (p) => p.$('.unchecked').isChecked() === false,
+ });
+
+ page.close();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/05-frame.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/05-frame.md
new file mode 100644
index 0000000000..93f97e1b93
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/05-frame.md
@@ -0,0 +1,57 @@
+---
+title: "Frame"
+excerpt: "Browser module: Frame Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/frame/
+---
+
+
+
+## Supported APIs
+
+| Method | Playwright Relevant Distinctions |
+| - | - |
+| frame.$(selector[, options]) | - |
+| frame.check(selector[, options]) | - |
+| frame.childFrames() | - |
+| frame.click(selector[, options]) | - |
+| frame.content() | - |
+| frame.dblclick(selector[, options]) | - |
+| frame.dispatchEvent(selector, type[, eventInit, options]) | - |
+| frame.evaluate(pageFunction[, arg]) | - |
+| frame.evaluateHandle(pageFunction[, arg]) | - |
+| frame.fill(selector, value[, options]) | - |
+| frame.focus(selector[, options]) | - |
+| frame.frameElement() | - |
+| frame.getAttribute(selector, name[, options]) | - |
+| frame.goto(url[, options]) | - |
+| frame.hover(selector[, options]) | - |
+| frame.innerHTML(selector[, options]) | - |
+| frame.innerText(selector[, options]) | - |
+| frame.inputValue(selector[, options]) | - |
+| frame.isChecked(selector[, options]) | - |
+| frame.isDetached() | - |
+| frame.isDisabled(selector[, options]) | - |
+| frame.isEditable(selector[, options]) | - |
+| frame.isEnabled(selector[, options]) | - |
+| frame.isHidden(selector[, options]) | - |
+| frame.isVisible(selector[, options]) | - |
+| frame.locator(selector[, options]) | - |
+| frame.name() | - |
+| frame.page() | - |
+| frame.parentFrame() | - |
+| frame.press(selector, key[, options]) | - |
+| frame.selectOption(selector, values[, options]) | - |
+| frame.setChecked(selector, checked[, options]) | - |
+| frame.setContent(html[, options]) | - |
+| frame.tap(selector[, options]) | - |
+| frame.textContent(selector[, options]) | - |
+| frame.title() | - |
+| frame.title() | - |
+| frame.uncheck(selector[, options]) | - |
+| frame.url() | - |
+| frame.waitForFunction(pageFunction[, arg, options]) | - |
+| frame.waitForLoadState([state, options]) | - |
+| frame.waitForNavigation([options]) | - |
+| frame.waitForSelector(selector[, options]) | - |
+| frame.waitForTimeout(timeout) | - |
+| frame.waitForURL(url[, options]) | - |
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/06-js-handle.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/06-js-handle.md
new file mode 100644
index 0000000000..8934829e9c
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/06-js-handle.md
@@ -0,0 +1,19 @@
+---
+title: "JSHandle"
+excerpt: "Browser module: JSHandle Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/jshandle/
+---
+
+
+
+## Supported APIs
+
+| Method | Playwright Relevant Distinctions |
+| - | - |
+| jsHandle.asElement() | - |
+| jsHandle.dispose() | - |
+| jsHandle.evaluate(pageFunction[, arg]) | - |
+| jsHandle.evaluateHandle(pageFunction[, arg]) | - |
+| jsHandle.getProperties() | - |
+| jsHandle.getProperty(propertyName) | - |
+| jsHandle.jsonValue() | - |
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/07-keyboard.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/07-keyboard.md
new file mode 100644
index 0000000000..54579fb415
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/07-keyboard.md
@@ -0,0 +1,17 @@
+---
+title: "Keyboard"
+excerpt: "Browser module: Keyboard Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/keyboard/
+---
+
+
+
+## Supported APIs
+
+| Method | Playwright Relevant Distinctions |
+| - | - |
+| keyboard.down(key) | - |
+| keyboard.insertText(text) | - |
+| keyboard.press(key[, options]) | - |
+| keyboard.type(text[, options]) | - |
+| keyboard.up(key) | - |
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator.md
new file mode 100644
index 0000000000..d03400c550
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator.md
@@ -0,0 +1,118 @@
+---
+title: "Locator"
+excerpt: "Browser module: Locator Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/
+---
+
+The Locator API makes it easier to work with dynamically changing elements. Some of the benefits of using it over existing ways to locate an element (e.g. `Page.$()`) include:
+
+- Helps with writing robust tests by finding an element even if the underlying frame navigates.
+- Makes it easier to work with dynamic web pages and SPAs built with Svelte, React, Vue, etc.
+- Enables the use of test abstractions like the Page Object Model (POM) pattern to simplify and organize tests.
+- `strict` mode is enabled for all `locator` methods, which means that if more than one element matches the given selector it will throw an error.
+
+Locator can be created with the [page.locator(selector[, options])](/javascript-api/k6-experimental/browser/page/#page-locator) method.
+
+| Method | Description |
+|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
+| [locator.check([options])](/javascript-api/k6-experimental/browser/locator/check) | Select the input checkbox. |
+| [locator.click([options])](/javascript-api/k6-experimental/browser/locator/click) | Mouse click on the chosen element. |
+| [locator.dblclick([options])](/javascript-api/k6-experimental/browser/locator/dblclick) | Mouse double click on the chosen element. |
+| [locator.dispatchEvent(type, eventInit, [options])](/javascript-api/k6-experimental/browser/locator/dispatchevent) | Dispatches HTML DOM event types e.g. `'click'`. |
+| [locator.fill(value, [options])](/javascript-api/k6-experimental/browser/locator/fill) | Fill an `input`, `textarea` or `contenteditable` element with the provided value. |
+| [locator.focus([options])](/javascript-api/k6-experimental/browser/locator/focus) | Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element, if it can be focused. |
+| [locator.getAttribute(name, [options])](/javascript-api/k6-experimental/browser/locator/getattribute) | Returns the element attribute value for the given attribute name. |
+| [locator.hover([options])](/javascript-api/k6-experimental/browser/locator/hover) | Hovers over the element. |
+| [locator.innerHTML([options])](/javascript-api/k6-experimental/browser/locator/innerhtml) | Returns the `element.innerHTML`. |
+| [locator.innerText([options])](/javascript-api/k6-experimental/browser/locator/innertext) | Returns the `element.innerText`. |
+| [locator.inputValue([options])](/javascript-api/k6-experimental/browser/locator/inputvalue) | Returns `input.value` for the selected `input`, `textarea` or `select` element. |
+| [locator.isChecked([options])](/javascript-api/k6-experimental/browser/locator/ischecked) | Checks if the `checkbox` `input` type is selected. |
+| [locator.isDisabled([options])](/javascript-api/k6-experimental/browser/locator/isdisabled) | Checks if the element is `disabled`. |
+| [locator.isEditable([options])](/javascript-api/k6-experimental/browser/locator/iseditable) | Checks if the element is `editable`. |
+| [locator.isEnabled([options])](/javascript-api/k6-experimental/browser/locator/isenabled) | Checks if the element is `enabled`. |
+| [locator.isHidden([options])](/javascript-api/k6-experimental/browser/locator/ishidden) | Checks if the element is `hidden`. |
+| [locator.isVisible([options])](/javascript-api/k6-experimental/browser/locator/isvisible) | Checks if the element is `visible`. |
+| [locator.press(key, [options])](/javascript-api/k6-experimental/browser/locator/press) | Press a single key on the keyboard or a combination of keys. |
+| [locator.selectOption(values, [options])](/javascript-api/k6-experimental/browser/locator/selectoption) | Select one or more options which match the values. |
+| [locator.tap([options])](/javascript-api/k6-experimental/browser/locator/tap) | Tap on the chosen element. |
+| [locator.textContent([options])](/javascript-api/k6-experimental/browser/locator/textcontent) | Returns the `element.textContent`. |
+| [locator.type(text, [options])](/javascript-api/k6-experimental/browser/locator/type) | Type in the text into the input field. |
+| [locator.uncheck([options])](/javascript-api/k6-experimental/browser/locator/uncheck) | Unselect the `input` checkbox. |
+| [locator.waitFor([options])](/javascript-api/k6-experimental/browser/locator/waitfor) | Wait for the element to be in a particular state e.g. `visible`. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+
+ try {
+ await page.goto("https://test.k6.io/flip_coin.php")
+
+ /*
+ In this example, we will use two locators, matching a
+ different betting button on the page. If you were to query
+ the buttons once and save them as below, you would see an
+ error after the initial navigation. Try it!
+
+ const heads = page.$("input[value='Bet on heads!']");
+ const tails = page.$("input[value='Bet on tails!']");
+
+ The Locator API allows you to get a fresh element handle each
+ time you use one of the locator methods. And, you can carry a
+ locator across frame navigations. Let's create two locators;
+ each locates a button on the page.
+ */
+ const heads = page.locator("input[value='Bet on heads!']");
+ const tails = page.locator("input[value='Bet on tails!']");
+
+ const currentBet = page.locator("//p[starts-with(text(),'Your bet: ')]");
+
+ // In the following Promise.all the tails locator clicks
+ // on the tails button by using the locator's selector.
+ // Since clicking on each button causes page navigation,
+ // waitForNavigation is needed -- this is because the page
+ // won't be ready until the navigation completes.
+ // Setting up the waitForNavigation first before the click
+ // is important to avoid race conditions.
+ await Promise.all([
+ page.waitForNavigation(),
+ tails.click(),
+ ]);
+ console.log(currentBet.innerText());
+ // the heads locator clicks on the heads button
+ // by using the locator's selector.
+ await Promise.all([
+ page.waitForNavigation(),
+ heads.click(),
+ ]);
+ console.log(currentBet.innerText());
+ await Promise.all([
+ page.waitForNavigation(),
+ tails.click(),
+ ]);
+ console.log(currentBet.innerText());
+ } finally {
+ page.close();
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/check--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/check--options--.md
new file mode 100644
index 0000000000..b77b958db5
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/check--options--.md
@@ -0,0 +1,59 @@
+---
+title: 'check([options])'
+excerpt: 'Browser module: locator.check method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/check/
+---
+
+
+
+This feature has known issues. For details, refer to
+[#471](https://github.com/grafana/xk6-browser/issues/471) and [#475](https://github.com/grafana/xk6-browser/issues/475).
+
+
+
+Use this method to select an `input` checkbox.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. |
+| options.position.x | number | `0` | The x coordinate. |
+| options.position.y | number | `0` | The y coordinate. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const checkbox = page.locator("#checkbox1");
+ checkbox.check();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/click--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/click--options--.md
new file mode 100644
index 0000000000..2abd3fe85b
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/click--options--.md
@@ -0,0 +1,95 @@
+---
+title: 'click([options])'
+excerpt: 'Browser module: locator.click method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/click/
+---
+
+
+
+This method has **known issues**. For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471) and [#474](https://github.com/grafana/xk6-browser/issues/474).
+
+
+
+Mouse click on the chosen element.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. |
+| options.clickCount | number | `1` | The number of times the action is performed. |
+| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. |
+| options.position.x | number | `0` | The x coordinate. |
+| options.position.y | number | `0` | The y coordinate. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. |
+
+
+
+### Examples
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+
+ await page.goto('https://test.k6.io/browser.php');
+ const button = page.locator('#counter-button');
+ await button.click();
+}
+```
+
+
+
+When a click action results in a page navigation, remember to work with `Promise.all()` and `page.waitForNavigation()` to properly handle the asynchronous operation.
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+
+ await page.goto('https://test.k6.io/');
+ const messagesLink = page.locator('a[href="/my_messages.php"]');
+
+ await Promise.all([page.waitForNavigation(), messagesLink.click()]);
+}
+```
+
+
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/dblclick--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/dblclick--options--.md
new file mode 100644
index 0000000000..e04e9d57f8
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/dblclick--options--.md
@@ -0,0 +1,62 @@
+---
+title: 'dblclick([options])'
+excerpt: 'Browser module: locator.dblclick method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/dblclick/
+---
+
+
+
+This feature has known issues. For details, refer to
+[#469](https://github.com/grafana/xk6-browser/issues/469) and [#471](https://github.com/grafana/xk6-browser/issues/471).
+
+
+
+Mouse double click on the chosen element.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. |
+| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. |
+| options.position.x | number | `0` | The x coordinate. |
+| options.position.y | number | `0` | The y coordinate. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const button = page.locator("#counter-button");
+ button.dblclick();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/dispatchevent--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/dispatchevent--options--.md
new file mode 100644
index 0000000000..62582a35f7
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/dispatchevent--options--.md
@@ -0,0 +1,49 @@
+---
+title: 'dispatchEvent(type, eventInit, [options])'
+excerpt: 'Browser module: locator.dispatchEvent method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/dispatchevent/
+---
+
+Dispatches HTML DOM event types e.g. `'click'`.
+
+
+
+| Parameter | Type | Defaults | Description |
+|-----------------|--------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| type | string | `''` | DOM event type e.g. `'click'`. |
+| eventInit | object | `null` | Optional event specific properties. See [eventInit](#eventinit) for more details. |
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### eventInit
+
+Since eventInit is event-specific, please refer to the events documentation for the lists of initial properties:
+
+- [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
+- [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
+- [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
+- [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
+- [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
+- [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
+- [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
+
+### Example
+
+
+
+```javascript
+import { chromium } from 'k6/experimental/browser';
+
+export default async function () {
+ const browser = chromium.launch();
+ const page = browser.newPage();
+
+ await page.goto('https://test.k6.io/browser.php');
+ const button = page.locator("#counter-button");
+ button.dispatchEvent('click');
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/fill--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/fill--options--.md
new file mode 100644
index 0000000000..acb18f00ad
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/fill--options--.md
@@ -0,0 +1,49 @@
+---
+title: 'fill(value, [options])'
+excerpt: 'Browser module: locator.fill method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/fill/
+---
+
+Fill an `input`, `textarea` or `contenteditable` element with the provided value.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| value | string | `''` | Value to set for the `input`, `textarea` or `contenteditable` element. |
+| options | object | `null` | |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const textbox = page.locator("#text1");
+ textbox.fill('hello world!');
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/focus--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/focus--options--.md
new file mode 100644
index 0000000000..1d506756af
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/focus--options--.md
@@ -0,0 +1,46 @@
+---
+title: 'focus([options])'
+excerpt: 'Browser module: locator.focus method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/focus/
+---
+
+Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element, if it can be focused on.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const textbox = page.locator("#text1");
+ textbox.focus();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/getattribute--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/getattribute--options--.md
new file mode 100644
index 0000000000..bf6f0af69c
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/getattribute--options--.md
@@ -0,0 +1,54 @@
+---
+title: 'getAttribute(name, [options])'
+excerpt: 'Browser module: locator.getAttribute method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/getattribute/
+---
+
+Returns the element attribute value for the given attribute name.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| name | string | `''` | Attribute name to get the value for. |
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|--------|-------------------------------------|
+| string | The value of the attribute or null. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const textbox = page.locator("#text1");
+ const attribute = textbox.getAttribute('onfocus');
+ console.log(attribute);
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/hover--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/hover--options--.md
new file mode 100644
index 0000000000..1047ed8873
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/hover--options--.md
@@ -0,0 +1,60 @@
+---
+title: 'hover([options])'
+excerpt: 'Browser module: locator.hover method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/hover/
+---
+
+
+
+This feature has known issues. For details, refer to
+[#471](https://github.com/grafana/xk6-browser/issues/471).
+
+
+
+Hovers over the element.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. |
+| options.position.x | number | `0` | The x coordinate. |
+| options.position.y | number | `0` | The y coordinate. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const offScreenElement = page.locator("#off-screen");
+ offScreenElement.hover();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/innerhtml--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/innerhtml--options--.md
new file mode 100644
index 0000000000..439fb1d090
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/innerhtml--options--.md
@@ -0,0 +1,53 @@
+---
+title: 'innerHTML([options])'
+excerpt: 'Browser module: locator.innerHTML method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/innerhtml/
+---
+
+Returns the `element.innerHTML`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|--------|--------------------------------|
+| string | The innerHTML of the element. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const offScreen = page.locator('#off-screen');
+ const innerHTML = offScreen.innerHTML();
+ console.log(innerHTML);
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/innertext--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/innertext--options--.md
new file mode 100644
index 0000000000..62d5a3fa25
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/innertext--options--.md
@@ -0,0 +1,53 @@
+---
+title: 'innerText([options])'
+excerpt: 'Browser module: locator.innerText method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/innertext/
+---
+
+Returns the `element.innerText`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|--------|--------------------------------|
+| string | The innerText of the element. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const offScreen = page.locator('#off-screen');
+ const innerText = offScreen.innerText();
+ console.log(innerText); // Off page div
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/inputvalue--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/inputvalue--options--.md
new file mode 100644
index 0000000000..f703b445b9
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/inputvalue--options--.md
@@ -0,0 +1,54 @@
+---
+title: 'inputValue([options])'
+excerpt: 'Browser module: locator.inputValue method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/inputvalue/
+---
+
+Returns `input.value` for the selected `input`, `textarea` or `select` element.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|--------|----------------------------------|
+| string | The input value of the element. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const textInput = page.locator('#text1');
+ textInput.fill("Hello world!");
+ const inputValue = textInput.inputValue();
+ console.log(inputValue);
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/ischecked--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/ischecked--options--.md
new file mode 100644
index 0000000000..8923d1fae0
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/ischecked--options--.md
@@ -0,0 +1,54 @@
+---
+title: 'isChecked([options])'
+excerpt: 'Browser module: locator.isChecked method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/ischecked/
+---
+
+Checks to see if the `checkbox` `input` type is selected or not.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|------|---------------------------------------------------|
+| bool | `true` if the checkbox is selected, else `false`. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const checkbox = page.locator('#checkbox1');
+ if (!checkbox.isChecked()) {
+ checkbox.check();
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isdisabled--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isdisabled--options--.md
new file mode 100644
index 0000000000..9784390496
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isdisabled--options--.md
@@ -0,0 +1,54 @@
+---
+title: 'isDisabled([options])'
+excerpt: 'Browser module: locator.isDisabled method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/isdisabled/
+---
+
+Checks if the element is `disabled`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|------|---------------------------------------------------|
+| bool | `true` if the element is `disabled`, else `false`. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator('#input-text-disabled');
+ if (text.isDisabled()) {
+ console.log("element is disabled")
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/iseditable--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/iseditable--options--.md
new file mode 100644
index 0000000000..2a183a61bf
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/iseditable--options--.md
@@ -0,0 +1,54 @@
+---
+title: 'isEditable([options])'
+excerpt: 'Browser module: locator.isEditable method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/iseditable/
+---
+
+Checks if the element is `editable`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|------|----------------------------------------------------|
+| bool | `true` if the element is `editable`, else `false`. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator('#text1');
+ if (text.isEditable()) {
+ text.fill("hello world!");
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isenabled--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isenabled--options--.md
new file mode 100644
index 0000000000..f65c521333
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isenabled--options--.md
@@ -0,0 +1,55 @@
+---
+title: 'isEnabled([options])'
+excerpt: 'Browser module: locator.isEnabled method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/isenabled/
+---
+
+Checks if the element is `enabled`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|------|---------------------------------------------------|
+| bool | `true` if the element is `enabled`, else `false`. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator('#text1');
+ if (text.isEnabled()) {
+ console.log("element is enabled");
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/ishidden--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/ishidden--options--.md
new file mode 100644
index 0000000000..9e9fd57ac9
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/ishidden--options--.md
@@ -0,0 +1,54 @@
+---
+title: 'isHidden([options])'
+excerpt: 'Browser module: locator.isHidden method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/ishidden/
+---
+
+Checks if the element is `hidden`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|------|---------------------------------------------------|
+| bool | `true` if the element is `hidden`, else `false`. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator('#input-text-hidden');
+ if (text.isHidden()) {
+ console.log("element is hidden");
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isvisible--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isvisible--options--.md
new file mode 100644
index 0000000000..50cb674a4b
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/isvisible--options--.md
@@ -0,0 +1,54 @@
+---
+title: 'isVisible([options])'
+excerpt: 'Browser module: locator.isVisible method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/isvisible/
+---
+
+Checks if the element is `visible`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|------|---------------------------------------------------|
+| bool | `true` if the element is `visible`, else `false`. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator('#text1');
+ if (text.isVisible()) {
+ console.log("element is visible");
+ }
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/press--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/press--options--.md
new file mode 100644
index 0000000000..3b072072ad
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/press--options--.md
@@ -0,0 +1,51 @@
+---
+title: 'press(key, [options])'
+excerpt: 'Browser module: locator.press method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/press/
+---
+
+Press a single key on the keyboard or a combination of keys.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| key | string | `''` | Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values). |
+| options | object | `null` | |
+| options.delay | number | `0` | Milliseconds to wait between `keydown` and `keyup`. |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator('#text1');
+ text.press('i');
+ text.press('ArrowLeft');
+ text.press('h');
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/selectoption--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/selectoption--options--.md
new file mode 100644
index 0000000000..b1b29f0841
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/selectoption--options--.md
@@ -0,0 +1,62 @@
+---
+title: 'selectOption(values, [options])'
+excerpt: 'Browser module: locator.selectOption method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/selectoption/
+---
+
+
+
+This feature has **known issues**. For details, refer to
+[#470](https://github.com/grafana/xk6-browser/issues/470) and [#471](https://github.com/grafana/xk6-browser/issues/471).
+
+
+
+Select one or more options which match the values.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|------------------------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| values | string or string[] or object | `''` | If the `select` has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. Object can be made up of keys with `value`, `label` or `index`. |
+| options | object | `null` | |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|----------|-------------------------------|
+| string[] | List of the selected options. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const options = page.locator('#numbers-options');
+ options.selectOption('three');
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/tap--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/tap--options--.md
new file mode 100644
index 0000000000..608e45cbf9
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/tap--options--.md
@@ -0,0 +1,50 @@
+---
+title: 'tap([options])'
+excerpt: 'Browser module: locator.tap method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/tap/
+---
+
+
+
+This feature has **known issues**. For details, refer to
+[#436](https://github.com/grafana/xk6-browser/issues/436) and [#471](https://github.com/grafana/xk6-browser/issues/471).
+
+
+
+Tap on the chosen element.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. |
+| options.position.x | number | `0` | The x coordinate. |
+| options.position.y | number | `0` | The y coordinate. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export default async function () {
+ const page = browser.newPage({
+ hasTouch: true,
+ });
+
+ await page.goto('https://test.k6.io/browser.php');
+ const options = page.locator("#numbers-options");
+ options.tap();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/textcontent--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/textcontent--options--.md
new file mode 100644
index 0000000000..686688c892
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/textcontent--options--.md
@@ -0,0 +1,52 @@
+---
+title: 'textContent([options])'
+excerpt: 'Browser module: locator.textContent method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/textcontent/
+---
+
+Returns the `element.textContent`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Returns
+
+| Type | Description |
+|--------|-------------------------------------------|
+| string | The text content of the selector or null. |
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const options = page.locator("#checkbox1");
+ console.log(options.textContent());
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/type--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/type--options--.md
new file mode 100644
index 0000000000..4d69ef2ba6
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/type--options--.md
@@ -0,0 +1,49 @@
+---
+title: 'type(text, [options])'
+excerpt: 'Browser module: locator.type method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/type/
+---
+
+Type in the text into the input field.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| text | string | `''` | A text to type into a focused element. |
+| options | object | `null` | |
+| options.delay | number | `0` | Milliseconds to wait between key presses. Defaults to `0`. |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator("#text1");
+ text.type('hello world!');
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/uncheck--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/uncheck--options--.md
new file mode 100644
index 0000000000..1bafa3614b
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/uncheck--options--.md
@@ -0,0 +1,60 @@
+---
+title: 'uncheck([options])'
+excerpt: 'Browser module: locator.uncheck method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/uncheck/
+---
+
+
+
+This feature has **known issues**.
+For details, refer to [#471](https://github.com/grafana/xk6-browser/issues/471).
+
+
+
+Unselect the `input` checkbox.
+
+
+
+| Parameter | Type | Default | Description |
+|---------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). |
+| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. |
+| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. |
+| options.position.x | number | `0` | The x coordinate. |
+| options.position.y | number | `0` | The y coordinate. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+ await page.goto('https://test.k6.io/browser.php');
+ const checkbox = page.locator("#checkbox1");
+ checkbox.check();
+ checkbox.uncheck();
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/waitfor--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/waitfor--options--.md
new file mode 100644
index 0000000000..f740d9d68b
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/waitfor--options--.md
@@ -0,0 +1,57 @@
+---
+title: 'waitFor([options])'
+excerpt: 'Browser module: locator.waitFor method'
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/locator/waitfor/
+---
+
+
+
+This feature has **known issues**. For details,
+refer to [#472](https://github.com/grafana/xk6-browser/issues/472).
+
+
+
+Wait for the element to be in a particular state e.g. `visible`.
+
+
+
+| Parameter | Type | Default | Description |
+|-----------------|--------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| options | object | `null` | |
+| options.state | string | `visible` | Can be `attached`, `detached`, `visible` or `hidden`. |
+| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) or [Page](/javascript-api/k6-experimental/browser/page/). |
+
+
+
+### Example
+
+
+
+```javascript
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
+export default async function () {
+ const page = browser.newPage();
+
+ await page.goto('https://test.k6.io/browser.php');
+ const text = page.locator('#input-text-hidden');
+ text.waitFor({
+ state: 'hidden',
+ });
+}
+```
+
+
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/09-mouse.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/09-mouse.md
new file mode 100644
index 0000000000..1e970fcb7a
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/09-mouse.md
@@ -0,0 +1,18 @@
+---
+title: "Mouse"
+excerpt: "Browser module: Mouse Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/mouse/
+---
+
+
+
+## Supported APIs
+
+| Method | Playwright Relevant Distinctions |
+| - | - |
+| mouse.click(x, y[, options]) | - |
+| mouse.dblclick(x, y[, options]) | - |
+| mouse.down([options]) | - |
+| mouse.move(x, y[, options]) | - |
+| mouse.up([options]) | - |
+| mouse.wheel(deltaX, deltaY) | - |
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page.md
new file mode 100644
index 0000000000..84822529c3
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page.md
@@ -0,0 +1,69 @@
+---
+title: "Page"
+excerpt: "Browser module: Page Class"
+canonicalUrl: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/page/
+---
+
+Page provides methods to interact with a single tab in a running web browser. A single [BrowserContext](https://k6.io/docs/javascript-api/k6-experimental/browser/browsercontext/) can have many `pages`.
+
+| Method | Description |
+|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
+| [page.bringToFront()](/javascript-api/k6-experimental/browser/page/bringtofront/) | Activates a browser tab. |
+| [page.check(selector[, options])](/javascript-api/k6-experimental/browser/page/check/) | Select the input checkbox. |
+| [page.click(selector[, options])](/javascript-api/k6-experimental/browser/page/click/) | Clicks on an element matching a `selector`. |
+| [page.close()](/javascript-api/k6-experimental/browser/page/close/) | Closes a tab that the `page` is associated with. |
+| [page.content()](/javascript-api/k6-experimental/browser/page/content/) | Gets the HTML contents of the page. |
+| [page.context()](/javascript-api/k6-experimental/browser/page/context/) | Gets the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) that the page belongs to. |
+| [page.dblclick(selector[, options])](/javascript-api/k6-experimental/browser/page/dblclick/) | With the [Mouse](/javascript-api/k6-experimental/browser/mouse/), double click on an element matching the provided `selector`. |
+| [page.dispatchEvent(selector, type, eventInit[, options])](/javascript-api/k6-experimental/browser/page/dispatchevent/) | Dispatches HTML DOM event types e.g. `'click'` |
+| [page.$(selector)](/javascript-api/k6-experimental/browser/page/page-$/) | Finds an element matching the specified `selector` within the page. |
+| [page.$$(selector)](/javascript-api/k6-experimental/browser/page/page-$$/) | Finds all elements matching the specified `selector` within the page. |
+| [page.emulateMedia([options])](/javascript-api/k6-experimental/browser/page/emulatemedia/) | Changes the CSS media type and the color scheme feature. |
+| [page.emulateVisionDeficiency(type)](/javascript-api/k6-experimental/browser/page/emulatevisiondeficiency/) | Emulates your website with the specified vision deficiency `type`. |
+| [page.evaluate(pageFunction[, arg])](/javascript-api/k6-experimental/browser/page/evaluate/) | Returns the value of the `pageFunction` invocation. |
+| [page.evaluateHandle(pageFunction[, arg])](/javascript-api/k6-experimental/browser/page/evaluate/) | Returns the value of the `pageFunction` invocation as a [JSHandle](/javascript-api/k6-experimental/browser/jshandle/). |
+| [page.fill(selector, value[, options])](/javascript-api/k6-experimental/browser/page/fill/) | Fill an `input`, `textarea` or `contenteditable` element with the provided value. |
+| [page.focus(selector[, options])](/javascript-api/k6-experimental/browser/page/focus/) | Fetches an element with `selector` and focuses on it. |
+| [page.frames()](/javascript-api/k6-experimental/browser/page/frames/) | Returns an array of frames on the page. |
+| [page.getAttribute(selector, name[, options])](/javascript-api/k6-experimental/browser/page/getattribute/) | Returns the element attribute value for the given attribute name. |
+| [page.goto(url[, options])](/javascript-api/k6-experimental/browser/page/goto/) | Navigates to the specified `url`. |
+| [page.hover(selector[, options])](/javascript-api/k6-experimental/browser/page/hover/) | Hovers over an element matching `selector`. |
+| [page.innerHTML(selector[, options])](/javascript-api/k6-experimental/browser/page/innerhtml/) | Returns the `element.innerHTML`. |
+| [page.innerText(selector[, options])](/javascript-api/k6-experimental/browser/page/innertext/) | Returns the `element.innerText`. |
+| [page.inputValue(selector[, options])](/javascript-api/k6-experimental/browser/page/inputvalue/) | Returns `input.value` for the selected `input`, `textarea` or `select` element. |
+| [page.isChecked(selector[, options])](/javascript-api/k6-experimental/browser/page/ischecked/) | Checks to see if the `checkbox` `input` type is selected or not. |
+| [page.isClosed()](/javascript-api/k6-experimental/browser/page/isclosed/) | Checks if the page has been closed. |
+| [page.isDisabled(selector[, options])](/javascript-api/k6-experimental/browser/page/isdisabled/) | Checks if the element is `disabled`. |
+| [page.isEditable(selector[, options])](/javascript-api/k6-experimental/browser/page/iseditable/) | Checks if the element is `editable`. |
+| [page.isEnabled(selector[, options])](/javascript-api/k6-experimental/browser/page/isenabled/) | Checks if the element is `enabled`. |
+| [page.isHidden(selector[, options])](/javascript-api/k6-experimental/browser/page/ishidden/) | Checks if the element is `hidden`. |
+| [page.isVisible(selector[, options])](/javascript-api/k6-experimental/browser/page/isvisible/) | Checks if the element is `visible`. |
+| [page.keyboard](/javascript-api/k6-experimental/browser/page/keyboard/) | Returns the [Keyboard](/javascript-api/k6-experimental/browser/keyboard/) instance to interact with a virtual keyboard on the page. |
+| [page.locator(selector)](/javascript-api/k6-experimental/browser/page/locator/) | Returns a [Locator](/javascript-api/k6-experimental/browser/locator/) for the given `selector`. |
+| [page.mainFrame()](/javascript-api/k6-experimental/browser/page/mainframe/) | Returns the page's main [Frame](/javascript-api/k6-experimental/browser/frame/). |
+| [page.mouse](/javascript-api/k6-experimental/browser/page/mouse/) | Returns the [Mouse](/javascript-api/k6-experimental/browser/mouse/) instance to interact with a virtual mouse on the page. |
+| [page.on(event, handler)](/javascript-api/k6-experimental/browser/page/on/) | Registers a handler to be called whenever the specified event occurs. |
+| [page.opener()](/javascript-api/k6-experimental/browser/page/opener/) | Returns the `page` that opened the current `page`. |
+| [page.press(selector, key[, options])](/javascript-api/k6-experimental/browser/page/press/) | Focuses the element, and then presses the given `key` on the [Keyboard](/javascript-api/k6-experimental/browser/keyboard/). |
+| [page.reload([options])](/javascript-api/k6-experimental/browser/page/reload/) | Reloads the current page. |
+| [page.screenshot([options])](/javascript-api/k6-experimental/browser/page/screenshot/) | Returns a buffer with the captured screenshot from the web browser. |
+| [page.selectOption(selector, values[, options])](/javascript-api/k6-experimental/browser/page/selectoption/) | Selects one or more options which match the values from a `