No results for

Powered byAlgolia

launch([options])

Launches a new browser process.

ParameterTypeDefaultDescription
argsstring[]nullExtra command line arguments to include when launching browser process. See this link for a list of Chromium arguments. Note that arguments should not start with -- (see the example).
debugbooleanfalseAll CDP messages and internal fine grained logs will be logged if set to true.
devtoolsbooleanfalseOpen up developer tools in the browser by default.
envstring[]nullEnvironment variables to set before launching browser process.
executablePathstringnullOverride search for browser executable in favor of specified absolute path.
headlessbooleantrueShow browser GUI or not.
ignoreDefaultArgsstring[]nullIgnore any of the default arguments included when launching browser process.
proxystringnullSpecify to set browser's proxy configuration.
slowMostringnullSlow down input actions and navigation by the specified time e.g. '500ms'.
timeoutstring'30s'Default timeout to use for various actions and navigation.

Returns

TypeDescription
objectBrowser object

Example

import { chromium } from 'k6/x/browser';
export default 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();
page
.goto('http://whatsmyuseragent.org/', {
waitUntil: 'networkidle',
})
.then(() => {
page.screenshot({ path: `example-chromium.png` });
})
.finally(() => {
page.close();
browser.close();
});
}