diff --git a/.vale/Vocab/docs/accept.txt b/.vale/Vocab/docs/accept.txt
index 664585813..c07f56a28 100644
--- a/.vale/Vocab/docs/accept.txt
+++ b/.vale/Vocab/docs/accept.txt
@@ -210,4 +210,5 @@ shm
srgb
kwallet
referer
-scrollable
\ No newline at end of file
+scrollable
+headful
\ No newline at end of file
diff --git a/gatsby-node.js b/gatsby-node.js
index aacdcb4ad..b27734978 100644
--- a/gatsby-node.js
+++ b/gatsby-node.js
@@ -1670,6 +1670,17 @@ const createRedirects = ({ actions }) => {
isPermanent: true,
});
+ createRedirect({
+ fromPath: '/using-k6-browser/selecting-elements/',
+ toPath: '/using-k6-browser/recommended-practices/selecting-elements/',
+ isPermanent: true,
+ });
+ createRedirect({
+ fromPath: '/using-k6-browser/examples/page-object-model/',
+ toPath: '/using-k6-browser/recommended-practices/page-object-model/',
+ isPermanent: true,
+ });
+
const redirects = {
'/javascript-api/k6-http/cookiejar-k6-http/':
'/javascript-api/k6-http/cookiejar/',
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
index dd97b461f..04d6518d2 100644
--- 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
@@ -9,55 +9,106 @@ The browser module APIs aim for rough compatibility with the [Playwright API for
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 [k6 version 0.43.0](https://github.com/grafana/k6/releases/tag/v0.43.0) or above.
+To work with the browser module, make sure you are using the latest [k6 version](https://github.com/grafana/k6/releases).
-## Modules
+## Properties
-The table below lists the importable properties from the top level module (`'k6/experimental/browser'`).
+The table below lists the properties you can import from the browser module (`'k6/experimental/browser'`).
| Property | Description |
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| chromium | A [BrowserType](/javascript-api/k6-experimental/browser/browsertype) to launch tests in a Chromium-based browser. |
+| 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. |
-| version | Returns the version number of k6 browser. |
-### 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`.
+## 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 { chromium, devices } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+ thresholds: {
+ checks: ["rate==1.0"]
+ }
+}
export default async function () {
- const browser = chromium.launch({ headless: false });
- const iphoneX = devices['iPhone X'];
- const context = browser.newContext(iphoneX);
- const page = context.newPage();
+ const page = browser.newPage();
try {
await page.goto('https://test.k6.io/');
} finally {
page.close();
- browser.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
+# When using the `k6:master-with-browser` Docker image, you need to add `--cap-add=SYS_ADMIN`
+# to grant further system permissions on the host for the Docker container.
+docker run --rm -i --cap-add=SYS_ADMIN grafana/k6:master-with-browser run - k6 run script.js
+```
+
+```bash
+PS C:\k6> k6 run script.js
+```
+
+
+
+
+
+
## Browser-level APIs
| k6 Class | Description |
|-------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| [Browser](/javascript-api/k6-experimental/browser/browser-class/) | The entry point for all tests and used to launch [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/)s and [Page](/javascript-api/k6-experimental/browser/page/)s. |
| [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) | Enables independent browser sessions with separate [Page](/javascript-api/k6-experimental/browser/page/)s, cache, and cookies. |
-| [BrowserType](/javascript-api/k6-experimental/browser/browsertype/) | The `BrowserType` is the entry point into launching a browser process; `chromium` is currently the only supported `BrowserType`. |
| [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. |
@@ -69,3 +120,129 @@ export default async function () {
| [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
+# When using the `k6:master-with-browser` Docker image, you need to add `--cap-add=SYS_ADMIN`
+# to grant further system permissions on the host for the Docker container.
+docker run --rm -i --cap-add=SYS_ADMIN -e K6_BROWSER_HEADLESS=false -e K6_BROWSER_ARGS='show-property-changed-rects' 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 [launch options](/javascript-api/k6-experimental/browser/browsertype/launch/) (default true). |
+| auto-open-devtools-for-tabs | `true`/`false` | This flag makes Chrome auto-open the DevTools window for each tab. It is intended to be used by developers and automation, not to require user interaction for opening DevTools. Set by [launch options](/javascript-api/k6-experimental/browser/browsertype/launch/) (default false). |
+| 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',
+ },
+ },
+ },
+ },
+ thresholds: {
+ checks: ["rate==1.0"]
+ }
+}
+
+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/01 Browser class.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class.md
deleted file mode 100644
index 50a3696a2..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class.md
+++ /dev/null
@@ -1,43 +0,0 @@
----
-title: "Browser class"
-excerpt: "Browser module: Browser Class"
----
-
-The `Browser` class 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.
-
-A new Browser instance (hence a new browser process) can be created using the `launch()` method of the `chromium` module from `'k6/experimental/browser'`.
-
-| Method | Description |
-|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
-| [browser.close()](/javascript-api/k6-experimental/browser/browser-class/close) | Closes the browser and all of its pages (if any were opened). |
-| [browser.contexts()](/javascript-api/k6-experimental/browser/browser-class/contexts) | Lets you access all open [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/)s. |
-| [browser.isConnected](/javascript-api/k6-experimental/browser/browser-class/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/browser-class/newcontext/) | Creates and returns a new [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/). |
-| [browser.newPage([options])](/javascript-api/k6-experimental/browser/browser-class/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. |
-| [browser.on('disconnected')](/javascript-api/k6-experimental/browser/browser-class/on/) | Detects the disconnected event from the browser application. |
-| [browser.version()](/javascript-api/k6-experimental/browser/browser-class/version/) | Returns the browser application's version. |
-
-### Example
-
-
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default async function () {
- const browser = chromium.launch();
- const context = browser.newContext();
- const page = context.newPage();
-
- try {
- await page.goto('https://test.k6.io/');
- } finally {
- page.close();
- browser.close();
- }
-}
-```
-
-
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/close.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/close.md
deleted file mode 100644
index f41ffb3b7..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/close.md
+++ /dev/null
@@ -1,28 +0,0 @@
----
-title: 'close()'
-excerpt: 'Browser module: Browser.close method'
----
-
-Closes the browser and all of its pages (if any were opened).
-
-The [Browser](/javascript-api/k6-experimental/browser/browser-class/) object cannot be used anymore and is considered disposed of.
-
-
-### Example
-
-
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default function () {
- const browser = chromium.launch();
- const context = browser.newContext();
- context.newPage();
-
- context.close();
- browser.close();
-}
-```
-
-
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/contexts.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/contexts.md
deleted file mode 100644
index db3784087..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/contexts.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-title: 'contexts()'
-excerpt: 'Browser module: Browser.contexts method'
----
-
-Access all open [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/)s.
-
-### Returns
-
-| Type | Description |
-| ----- | ------------------------------------------------------------------------------ |
-| Array | Array of [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/) objects |
-
-
-### Example
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default function () {
- const browser = chromium.launch();
- console.log(browser.contexts().length); // 0
-
- const context = browser.newContext();
- console.log(browser.contexts().length); // 1
-
- context.close();
- browser.close();
-}
-```
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/on--event--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/on--event--.md
deleted file mode 100644
index 13faa88c4..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser class/on--event--.md
+++ /dev/null
@@ -1,63 +0,0 @@
----
-title: 'on(event)'
-excerpt: 'Browser module: Browser.on method'
----
-
-Detects events from the browser application.
-
-| Parameter | Type | Description |
-| --------- | ------ | -------------------------------------------------- |
-| event | string | The only accepted event value is `'disconnected'`. |
-
-### Returns
-
-The returned promise will be resolved when the [Browser](/javascript-api/k6-experimental/browser/browser-class/) disconnects from the browser application. Possible reasons for this might be happening as follows:
-
-* Closed or crashed browser application.
-* Calling of the [browser.close()](/javascript-api/k6-experimental/browser/browser-class/close) method.
-
-| Type | Description |
-| ------- | ------------------------------------------------------------------------------- |
-| promise | On returns a Promise that is resolved when the browser process is disconnected. |
-
-### Example
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-import { check, sleep } from 'k6';
-
-export default function() {
- const browser = chromium.launch();
-
- check(browser, {
- 'should be connected after launch': browser.isConnected(),
- });
-
- const handlerCalled = Symbol();
-
- const p = browser.on('disconnected')
- // The promise resolve/success handler
- .then((val) => {
- check(browser, {
- 'should be disconnected on event': !browser.isConnected(),
- });
- return handlerCalled;
- // The promise reject/failure handler
- }, (val) => {
- console.error(`promise rejected: ${val}`);
- });
-
- p.then((val) => {
- check(val, {
- 'the browser.on success handler should be called': val === handlerCalled,
- });
- });
-
- check(browser, {
- 'should be connected before ending iteration': browser.isConnected(),
- });
-
- // Disconnect from the browser instance.
- browser.close();
-}
-```
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser module.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser module.md
new file mode 100644
index 000000000..6fc46cd9a
--- /dev/null
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/01 Browser module.md
@@ -0,0 +1,53 @@
+****---
+title: "Browser module"
+excerpt: "Browser module"
+---
+
+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.
+
+A new browser process is automatically created when you use the `newContext` method of the `browser` module (`'k6/experimental/browser'`).
+
+| Method | Description |
+|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
+| [browser.contexts()](/javascript-api/k6-experimental/browser/browser-module/contexts) | Lets you access all open [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/)s. |
+| [browser.isConnected](/javascript-api/k6-experimental/browser/browser-module/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/browser-module/newcontext/) | Creates and returns a new [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext/). |
+| [browser.newPage([options])](/javascript-api/k6-experimental/browser/browser-module/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. |
+| [browser.version()](/javascript-api/k6-experimental/browser/browser-module/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',
+ },
+ },
+ },
+ },
+ thresholds: {
+ checks: ["rate==1.0"]
+ }
+}
+
+export default async function () {
+ const page = browser.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
index 94255de37..a5539ded3 100644
--- 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
@@ -3,16 +3,15 @@ title: "BrowserContext"
excerpt: "Browser module: BrowserContext Class"
---
-`BrowserContext`s provide a way to operate multiple independent sessions, with separate pages, cache, and cookies. A default `BrowserContext` is created when a [Browser](/javascript-api/k6-experimental/browser/browser-class/) is launched.
+`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](/javascript-api/k6-experimental/browser/browser-class/) type is used to create a new `BrowserContext`.
+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.browser()](/javascript-api/k6-experimental/browser/browsercontext/browser-instance/) | Returns the [Browser](/javascript-api/k6-experimental/browser/browser-class/) instance that this `BrowserContext` belongs to. |
| [BrowserContext.addCookies()](/javascript-api/k6-experimental/browser/browsercontext/addcookies/) | Adds cookies into the `BrowserContext`. |
| [BrowserContext.clearCookies()](/javascript-api/k6-experimental/browser/browsercontext/clearcookies/) | Clear the `BrowserContext`'s cookies. |
| [BrowserContext.clearPermissions()](/javascript-api/k6-experimental/browser/browsercontext/clearpermissions) | Clears all permission overrides for the `BrowserContext`. |
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
index 78ffc4b49..825028575 100644
--- 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
@@ -10,10 +10,22 @@ Adds cookies into the `BrowserContext`. All pages within this context will have
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const context = browser.newContext();
context.addCookies([
@@ -26,6 +38,7 @@ export default async function () {
const page = context.newPage();
await page.goto('https://test.k6.io/');
+ page.close();
}
```
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/browser.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/browser.md
deleted file mode 100644
index bd71cafd2..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/02 BrowserContext/browser.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-title: 'browser instance'
-excerpt: 'Returns the browser instance that this BrowserContext belongs to.'
----
-
-Returns the [browser](/javascript-api/k6-experimental/browser/browser-class/) instance that this `BrowserContext` belongs to.
-
-
-### Returns
-
-| Type | Description |
-| ---------------------------------------------- | ----------------------- |
-| [Browser](/javascript-api/k6-experimental/browser/browser-class/) | The Browser instance. |
-
-
-### Example
-
-
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default function () {
- const browser = chromium.launch();
- const context = browser.newContext();
- const contextBrowser = context.browser();
- contextBrowser.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
index 3f875d1f4..244c30db2 100644
--- 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
@@ -17,10 +17,22 @@ Clears the `BrowserContext`'s cookies.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const context = browser.newContext();
const page = context.newPage();
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
index 2b65937b2..70d248425 100644
--- 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
@@ -18,10 +18,22 @@ Clears all permission overrides for the `BrowserContext`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default function () {
- const browser = chromium.launch();
const context = browser.newContext();
context.grantPermissions(['clipboard-read']);
// do stuff ...
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
index 4f1f2f9f9..84744d4e4 100644
--- 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
@@ -11,15 +11,26 @@ Close the `BrowserContext` and all its [page](/javascript-api/k6-experimental/br
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default function () {
- const browser = chromium.launch();
const context = browser.newContext();
context.newPage();
context.close();
- browser.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
index d9beeb20e..c863ac86d 100644
--- 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
@@ -21,10 +21,22 @@ Grants specified permissions to the `BrowserContext`. Only grants corresponding
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default function () {
- const browser = chromium.launch();
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
index f81c7a822..1d580a09b 100644
--- 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
@@ -18,18 +18,15 @@ Uses the `BrowserContext` to create a new [Page](/javascript-api/k6-experimental
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
export default async function () {
- const browser = chromium.launch();
- const context = browser.newContext();
- const page = context.newPage();
+ const page = browser.newPage();
try {
await page.goto('https://test.k6.io/browser.php');
} finally {
page.close();
- browser.close();
}
}
```
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
index ab4c3eef3..b81aa4aee 100644
--- 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
@@ -25,17 +25,27 @@ Returns all open [Page](/javascript-api/k6-experimental/browser/page/)s in the `
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default function () {
- const browser = chromium.launch();
const context = browser.newContext();
context.newPage();
const pages = context.pages();
console.log(pages.length); // 1
-
context.close();
- browser.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
index 04c5fbf92..6dd5939ed 100644
--- 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
@@ -22,10 +22,22 @@ Sets the default maximum navigation timeout for [Page.goto()](https://playwright
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const context = browser.newContext();
const page = context.newPage();
context.setDefaultNavigationTimeout(1000); // 1s
@@ -34,7 +46,6 @@ export default async function () {
await page.goto('https://httpbin.test.k6.io/delay/5');
} finally {
page.close();
- browser.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
index 8672c76ca..06522a89d 100644
--- 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
@@ -22,10 +22,22 @@ Sets the default maximum timeout for all methods accepting a `timeout` option in
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const context = browser.newContext();
context.setDefaultTimeout(1000); // 1s
const page = context.newPage();
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
index 56e16254b..ecb5ec8fd 100644
--- 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
@@ -28,10 +28,22 @@ Sets the context's geolocation.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default function () {
- const browser = chromium.launch();
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
index 03abb3cdc..61a091c20 100644
--- 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
@@ -15,10 +15,22 @@ Toggles the `BrowserContext`'s connectivity on/off.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const context = browser.newContext();
context.setOffline(true);
@@ -30,7 +42,6 @@ export default async function () {
await page.goto('https://test.k6.io/browser.php');
} finally {
page.close();
- browser.close();
}
}
```
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType.md
deleted file mode 100644
index 59453b490..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType.md
+++ /dev/null
@@ -1,40 +0,0 @@
----
-title: "BrowserType"
-excerpt: "Browser module: BrowserType Class"
----
-
-The `BrowserType` is the entry point into launching a browser process; `chromium` is currently the only supported `BrowserType`. To use it, import `chromium` from the top level module `k6/experimental/browser`.
-
-| Method | Description |
-|-----------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
-| [browserType.connect(wsURL, [options])](/javascript-api/k6-experimental/browser/browsertype/connect/) | Connect attaches k6 browser to an existing browser instance. |
-| [browserType.executablePath()](/javascript-api/k6-experimental/browser/browsertype/executablepath/) | Returns the path where the extension expects to find the browser executable. |
-| [browserType.launch([options])](/javascript-api/k6-experimental/browser/browsertype/launch/) | Launches a new browser process. |
-| browserType.launchPersistentContext(userDataDir, [options]) | Launches the browser with persistent storage. |
-| [browserType.name()](/javascript-api/k6-experimental/browser/browsertype/name/) | Returns the name of the `BrowserType`; currently it will return `chromium`. |
-
-
-## Example
-
-
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default async function () {
- const browser = chromium.launch();
- const context = browser.newContext();
- const page = context.newPage();
-
- try {
- await page.goto('https://test.k6.io/');
- page.screenshot({ path: `example-chromium.png` });
- } finally {
- page.close();
- browser.close();
- }
-}
-```
-
-
-
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/connect--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/connect--options--.md
deleted file mode 100644
index efae3428d..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/connect--options--.md
+++ /dev/null
@@ -1,49 +0,0 @@
----
-title: 'connect(wsURL, [options])'
-excerpt: 'Browser module: BrowserType.connect method'
----
-
-Connects to an existing browser instance.
-
-| Parameter | Type | Default | Description |
-|-------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| debug | boolean | `false` | All CDP messages and internal fine grained logs will be logged if set to `true`. |
-| slowMo | string | `null` | Slow down input actions and navigation by the specified time e.g. `'500ms'`. |
-| timeout | string | `'30s'` | Default timeout to use for various actions and navigation. |
-
-
-### Returns
-
-| Type | Description |
-|--------|--------------------------------------------------------|
-| object | [Browser](/javascript-api/k6-browser/api/browser/) object |
-
-
-## Example
-
-
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default async function () {
- const wsURL = 'ws://localhost:9222/devtools/browser/a7ee4f2d-35cf-4478-a333-f597e1532ab0';
- const browser = chromium.connect(wsURL, {
- debug: true,
- slowMo: '500ms',
- timeout: '30s',
- });
- const context = browser.newContext();
- const page = context.newPage();
-
- try {
- await page.goto('https://test.k6.io/');
- page.screenshot({ path: `example-chromium.png` });
- } finally {
- page.close();
- browser.close();
- }
-}
-```
-
-
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/executablePath.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/executablePath.md
deleted file mode 100644
index e8c65bc68..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/executablePath.md
+++ /dev/null
@@ -1,25 +0,0 @@
----
-title: 'executablePath()'
-excerpt: 'Browser module: BrowserType.executablePath method'
----
-
-Returns the path where the extension expects to find the browser executable.
-
-
-### Returns
-
-| Type | Description |
-|--------|--------------------------------------|
-| string | The expected browser executable path |
-
-
-## Example
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default function () {
- const execPath = chromium.executablePath();
- console.log(execPath);
-}
-```
\ No newline at end of file
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/launch--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/launch--options--.md
deleted file mode 100644
index c4b08b236..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/launch--options--.md
+++ /dev/null
@@ -1,112 +0,0 @@
----
-title: 'launch([options])'
-excerpt: 'Browser module: BrowserType.launch method'
----
-
-Launches a new browser process.
-
-
-
-| Parameter | Type | Default | Description |
-|-------------------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| args | string[] | `null` | 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)). |
-| debug | boolean | `false` | All CDP messages and internal fine grained logs will be logged if set to `true`. |
-| devtools | boolean | `false` | Open up developer tools in the browser by default. |
-| env | string[] | `null` | Environment variables to set before launching browser process. |
-| executablePath | string | `null` | Override search for browser executable in favor of specified absolute path. |
-| headless | boolean | `true` | Show browser GUI or not. |
-| ignoreDefaultArgs | string[] | `null` | Ignore any of the [default arguments](#default-arguments) included when launching browser process. |
-| proxy | string | `null` | Specify to set browser's proxy configuration. |
-| slowMo | string | `null` | Slow down input actions and navigation by the specified time e.g. `'500ms'`. |
-| timeout | string | `'30s'` | Default timeout to use for various actions and navigation. |
-
-
-## Default arguments
-
-List of default arguments included when launching the browser process. You can pass one or more of the arguments to the `ignoreDefaultArgs` field when launching a browser 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 [launch options](/javascript-api/k6-experimental/browser/browsertype/launch/) (default true). |
-| auto-open-devtools-for-tabs | `true`/`false` | This flag makes Chrome auto-open the DevTools window for each tab. It is intended to be used by developers and automation, not to require user interaction for opening DevTools. Set by [launch options](/javascript-api/k6-experimental/browser/browsertype/launch/) (default false). |
-| 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 [launch options](/javascript-api/k6-experimental/browser/browsertype/launch/), 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. |
-
-
-
-
-### Returns
-
-| Type | Description |
-|--------|--------------------------------------------------------|
-| object | [Browser](/javascript-api/k6-experimental/browser/browser-class/) object |
-
-
-## Example
-
-
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default async function () {
- const browser = chromium.launch({
- args: ['show-property-changed-rects'],
- debug: true,
- devtools: true,
- executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
- headless: false,
- slowMo: '500ms',
- timeout: '30s',
- });
- const context = browser.newContext();
- const page = context.newPage();
-
- try {
- await page.goto('http://whatsmyuseragent.org/');
- page.screenshot({ path: `example-chromium.png` });
- } finally {
- page.close();
- browser.close();
- }
-}
-```
-
-
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/name.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/name.md
deleted file mode 100644
index 547f48967..000000000
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/03 BrowserType/name.md
+++ /dev/null
@@ -1,25 +0,0 @@
----
-title: 'name()'
-excerpt: 'Browser module: BrowserType.name method'
----
-
-Returns the name of the `BrowserType`; currently it will return `chromium`.
-
-
-### Returns
-
-| Type | Description |
-|--------|------------------------------|
-| string | Currently returns `chromium` |
-
-
-## Example
-
-```javascript
-import { chromium } from 'k6/experimental/browser';
-
-export default function () {
- const name = chromium.name();
- console.log(name);
-}
-```
\ No newline at end of file
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
index c35593385..4fc38530a 100644
--- 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
@@ -50,15 +50,23 @@ excerpt: "Browser module: ElementHandle Class"
```javascript
import { check } from 'k6';
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch({
- headless: false,
- slowMo: '500ms', // slow down by 500ms
- });
- const context = browser.newContext();
- const page = context.newPage();
+ const page = browser.newPage();
// Goto front page, find login link and click it
try {
@@ -78,7 +86,6 @@ export default async function () {
});
} finally {
page.close();
- browser.close();
}
}
```
@@ -88,15 +95,24 @@ export default async function () {
```javascript
-import { chromium } from 'k6/experimental/browser';
+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 browser = chromium.launch({
- headless: false,
- });
- const context = browser.newContext();
- const page = context.newPage();
+ const page = browser.newPage();
// Inject page content
page.setContent(`
@@ -121,7 +137,6 @@ export default function () {
});
page.close();
- browser.close();
}
```
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
index 8864f45ac..14afe8c38 100644
--- 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
@@ -44,14 +44,23 @@ Locator can be created with the [page.locator(selector[, options])](/javascript-
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch({
- headless: false,
- });
- const context = browser.newContext();
- const page = context.newPage();
+ const page = browser.newPage();
try {
await page.goto("https://test.k6.io/flip_coin.php")
@@ -101,7 +110,6 @@ export default async function () {
console.log(currentBet.innerText());
} finally {
page.close();
- browser.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
index c72dbb956..efe818b05 100644
--- 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
@@ -32,12 +32,23 @@ Use this method to select an `input` checkbox.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
- const page = browser.newPage();
-
+ 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
index e24e59601..478240f89 100644
--- 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
@@ -35,10 +35,22 @@ Mouse click on the chosen element.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
@@ -54,10 +66,22 @@ When a click action results in a page navigation, remember to work with `Promise
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/');
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
index 4c575a162..d0a702de5 100644
--- 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
@@ -35,12 +35,23 @@ Mouse double click on the chosen element.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
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.dblclick();
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
index 9a1a44abd..d466e7679 100644
--- 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
@@ -22,12 +22,23 @@ Fill an `input`, `textarea` or `contenteditable` element with the provided value
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
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
index 8ddb176cd..11da8af49 100644
--- 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
@@ -19,12 +19,23 @@ Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
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
index e54509059..f14947b88 100644
--- 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
@@ -26,12 +26,23 @@ Returns the element attribute value for the given attribute name.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const textbox = page.locator("#text1");
const attribute = textbox.getAttribute('onfocus');
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
index 824e5c081..dfe25e645 100644
--- 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
@@ -33,12 +33,23 @@ Hovers over the element.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
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
index 0b6411e68..3982654a4 100644
--- 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
@@ -25,12 +25,23 @@ Returns the `element.innerHTML`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const offScreen = page.locator('#off-screen');
const innerHTML = offScreen.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
index 7398c89dd..3be75b4db 100644
--- 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
@@ -25,12 +25,23 @@ Returns the `element.innerText`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const offScreen = page.locator('#off-screen');
const innerText = offScreen.innerText();
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
index 2ff53a138..c83dc0711 100644
--- 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
@@ -25,12 +25,23 @@ Returns `input.value` for the selected `input`, `textarea` or `select` element.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const textInput = page.locator('#text1');
textInput.fill("Hello world!");
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
index e6b540019..e57ffcd0b 100644
--- 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
@@ -25,12 +25,23 @@ Checks to see if the `checkbox` `input` type is selected or not.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const checkbox = page.locator('#checkbox1');
if (!checkbox.isChecked()) {
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
index b36fe68e9..02c3bf2f7 100644
--- 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
@@ -25,16 +25,27 @@ Checks if the element is `disabled`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
- const text = page.locator('#input-text-disabled');
+ const text = page.locator('#input-text-disabled');
if (text.isDisabled()) {
- console.log("element is disabled")
+ 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
index 5ac2c077c..91f025332 100644
--- 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
@@ -25,12 +25,23 @@ Checks if the element is `editable`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const text = page.locator('#text1');
if (text.isEditable()) {
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
index 3a42dbebd..3466bae95 100644
--- 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
@@ -25,10 +25,22 @@ Checks if the element is `enabled`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
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
index 17a52ba17..2ace3b0a8 100644
--- 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
@@ -25,16 +25,27 @@ Checks if the element is `hidden`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
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");
+ 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
index aa712f402..3c5860654 100644
--- 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
@@ -25,12 +25,23 @@ Checks if the element is `visible`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const text = page.locator('#text1');
if (text.isVisible()) {
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
index 2537e9b73..7e62158d9 100644
--- 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
@@ -22,12 +22,23 @@ Press a single key on the keyboard or a combination of keys.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
const text = page.locator('#text1');
text.press('i');
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
index 52e36aa9b..67f9cf4b3 100644
--- 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
@@ -35,12 +35,23 @@ Select one or more options which match the values.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
- const page = browser.newPage();
-
+ 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
index e42f140dc..660d57781 100644
--- 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
@@ -33,18 +33,16 @@ Tap on the chosen element.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
export default async function () {
- const browser = chromium.launch();
- const context = browser.newContext();
- const page = context.newPage({
+ const page = browser.newPage({
hasTouch: true,
});
await page.goto('https://test.k6.io/browser.php');
const options = page.locator("#numbers-options");
- options.tap();
+ 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
index b30894613..a742911ff 100644
--- 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
@@ -25,12 +25,23 @@ Returns the `element.textContent`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
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
index d29402b93..792109b3a 100644
--- 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
@@ -22,12 +22,23 @@ Type in the text into the input field.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
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
index 0f36587c3..5d57a916c 100644
--- 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
@@ -32,12 +32,23 @@ Unselect the `input` checkbox.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
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/waitfor--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/08 Locator/waitfor--options--.md
index ce4dfe1c1..36627c134 100644
--- 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
@@ -27,10 +27,22 @@ Wait for the element to be in a particular state e.g. `visible`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/bringToFront.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/bringToFront.md
index bdf4e2259..002691742 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/bringToFront.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/bringToFront.md
@@ -11,12 +11,23 @@ Activates the browser tab which brings the page in focus to allow actions to be
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
// perform other actions that might open up a different tab, taking focus away from the initial page.
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/check--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/check--options--.md
index a2674e8a9..d056f840f 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/check--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/check--options--.md
@@ -33,12 +33,23 @@ This method is used to select an input checkbox.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch({ headless: false, slowMo: '1s'});
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
page.check("#checkbox1");
}
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/click--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/click--options--.md
index 2bec619ce..91aa83fe0 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/click--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/click--options--.md
@@ -43,10 +43,22 @@ This method clicks on an element matching a `selector`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
@@ -61,10 +73,22 @@ When a click action results in a page navigation, remember to work with `page.wa
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/close.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/close.md
index 2322a60bd..256060790 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/close.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/close.md
@@ -10,10 +10,22 @@ This will close the tab that this page is associated with.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/content.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/content.md
index 6fc98256f..4b9f8c61d 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/content.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/content.md
@@ -16,10 +16,22 @@ Gets the HTML contents of the page.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/context.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/context.md
index 86aedf822..0a3b1b3fd 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/context.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/context.md
@@ -16,10 +16,22 @@ Gets the [BrowserContext](/javascript-api/k6-experimental/browser/browsercontext
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dblclick--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dblclick--options--.md
index e6886e816..c6e494209 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dblclick--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dblclick--options--.md
@@ -36,10 +36,22 @@ Mouse double clicks an element matching provided selector.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dispatchEvent--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dispatchEvent--options--.md
index 152deb4e9..d9785a1bb 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dispatchEvent--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dispatchEvent--options--.md
@@ -41,10 +41,22 @@ Since `eventInit` is event-specific, please refer to the events documentation fo
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dollar--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dollar--options--.md
index a2791ce2e..9d15b0b38 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dollar--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/dollar--options--.md
@@ -22,10 +22,22 @@ The method finds an element matching the specified selector within the page. If
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/doubledollar--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/doubledollar--options--.md
index 61f61a365..874639025 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/doubledollar--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/doubledollar--options--.md
@@ -22,10 +22,22 @@ The method finds all elements matching the specified selector within the page. I
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateMedia--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateMedia--options--.md
index 4124908ed..690a95da0 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateMedia--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateMedia--options--.md
@@ -24,10 +24,22 @@ This method changes the CSS `@media type` through the `media` argument, and/or t
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateVisionDeficiency--type--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateVisionDeficiency--type--.md
index 663942160..c11690f77 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateVisionDeficiency--type--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/emulateVisionDeficiency--type--.md
@@ -18,10 +18,22 @@ The supported types are:
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluate.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluate.md
index 1829e7ab9..820305df7 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluate.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluate.md
@@ -27,11 +27,23 @@ Returns the value of the `pageFunction` invocation.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
import { check } from 'k6/http';
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
+
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluateHandle.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluateHandle.md
index 832a20ec2..c8a871d9b 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluateHandle.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/evaluateHandle.md
@@ -30,10 +30,22 @@ The only difference between `page.evaluate()` and `page.evaluateHandle()` is tha
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/fill--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/fill--options--.md
index 678e3d9a7..d6655cc18 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/fill--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/fill--options--.md
@@ -30,10 +30,22 @@ Fill an `input`, `textarea` or `contenteditable` element with the provided value
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/focus--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/focus--options--.md
index 2d7a3aabe..9eb91827d 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/focus--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/focus--options--.md
@@ -27,10 +27,22 @@ This method fetches an element with `selector` and focuses it.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/frames.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/frames.md
index e4d157dc8..33e83b1a5 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/frames.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/frames.md
@@ -16,10 +16,22 @@ Returns an array of [Frames](/javascript-api/k6-experimental/browser/frame/) on
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/getattribute--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/getattribute--options--.md
index 0fa417847..05474f01e 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/getattribute--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/getattribute--options--.md
@@ -34,10 +34,22 @@ Returns the element attribute value for the given attribute name.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/goto--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/goto--options--.md
index ce73b3986..66f47ed4e 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/goto--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/goto--options--.md
@@ -44,16 +44,25 @@ Events can be either:
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
-
page.close();
- browser.close();
}
```
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/hover--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/hover--options--.md
index c82fc5de4..801a0ed42 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/hover--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/hover--options--.md
@@ -34,12 +34,23 @@ This method hovers over an element matching `selector`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
-
await page.goto('https://test.k6.io/browser.php');
page.hover("#off-screen");
}
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innerhtml--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innerhtml--options--.md
index e3f824029..d5933d568 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innerhtml--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innerhtml--options--.md
@@ -33,10 +33,22 @@ Returns the `element.innerHTML`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innertext--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innertext--options--.md
index 60f4ee9c6..e1bc9b685 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innertext--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/innertext--options--.md
@@ -33,10 +33,22 @@ Returns the `element.innerText`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/inputvalue--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/inputvalue--options--.md
index 9d4c772b9..b95489406 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/inputvalue--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/inputvalue--options--.md
@@ -33,10 +33,22 @@ Returns `input.value` for the selected `input`, `textarea` or `select` element.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ischecked--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ischecked--options--.md
index d17b3bb7e..4aa234013 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ischecked--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ischecked--options--.md
@@ -33,10 +33,22 @@ Checks to see if the `checkbox` `input` type is selected or not.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isclosed--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isclosed--options--.md
index b811ef615..2e94e1a33 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isclosed--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isclosed--options--.md
@@ -22,10 +22,22 @@ Checks if the page has been closed.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isdisabled--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isdisabled--options--.md
index a99e4b374..e4efebc8a 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isdisabled--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isdisabled--options--.md
@@ -33,10 +33,22 @@ Checks if the element is `disabled`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/iseditable--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/iseditable--options--.md
index 1859249a5..d70eb5aff 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/iseditable--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/iseditable--options--.md
@@ -33,10 +33,22 @@ Checks if the element is `editable`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isenabled--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isenabled--options--.md
index c094720e5..429db0075 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isenabled--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isenabled--options--.md
@@ -33,10 +33,22 @@ Checks if the element is `enabled`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ishidden--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ishidden--options--.md
index c62c4835e..c228edefa 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ishidden--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/ishidden--options--.md
@@ -33,10 +33,22 @@ Checks if the element is `hidden`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isvisible--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isvisible--options--.md
index e74fd1337..95e152e08 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isvisible--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/isvisible--options--.md
@@ -33,10 +33,22 @@ Checks if the element is `visible`.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/keyboard.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/keyboard.md
index 73eb7cd51..62e020926 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/keyboard.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/keyboard.md
@@ -16,10 +16,22 @@ Returns the [Keyboard](/javascript-api/k6-experimental/browser/keyboard/) instan
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/locator.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/locator.md
index d57d6ab01..f6b9c3f2e 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/locator.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/locator.md
@@ -21,10 +21,22 @@ The method returns an element [Locator](/javascript-api/k6-experimental/browser/
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mainframe.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mainframe.md
index ad3a9b175..757dacc40 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mainframe.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mainframe.md
@@ -16,10 +16,22 @@ The page's main frame. Page is made up of frames in a hierarchical. At the top i
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mouse.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mouse.md
index ad215a16f..40491efaf 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mouse.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/mouse.md
@@ -16,10 +16,22 @@ Returns the [Mouse](/javascript-api/k6-experimental/browser/mouse/) instance to
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/opener.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/opener.md
index 43c9a83ad..a856324ad 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/opener.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/opener.md
@@ -16,10 +16,22 @@ Returns the page that opened the current page. The first page that is navigated
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/press--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/press--options--.md
index b10812485..c19e73af1 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/press--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/press--options--.md
@@ -39,10 +39,22 @@ Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported a
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/reload--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/reload--options--.md
index 4a9e6ba0c..d70484fa0 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/reload--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/reload--options--.md
@@ -40,10 +40,22 @@ Events can be either:
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/screenshot--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/screenshot--options--.md
index c1c331a38..b1974c55b 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/screenshot--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/screenshot--options--.md
@@ -34,10 +34,22 @@ Returns the buffer with the captured screenshot from the browser.
```javascript
-import { chromium } from 'k6/experimental/browser';
+import { browser } from 'k6/experimental/browser';
+
+export const options = {
+ scenarios: {
+ browser: {
+ executor: 'shared-iterations',
+ options: {
+ browser: {
+ type: 'chromium',
+ },
+ },
+ },
+ },
+}
export default async function () {
- const browser = chromium.launch();
const page = browser.newPage();
await page.goto('https://test.k6.io/browser.php');
diff --git a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/selectoption--options--.md b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/selectoption--options--.md
index 3b241ea3b..cb974856a 100644
--- a/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/selectoption--options--.md
+++ b/src/data/markdown/docs/02 javascript api/07 k6-experimental/01 browser/10 Page/selectoption--options--.md
@@ -36,10 +36,22 @@ Selects one or more options which match the values from a `