No results for

Powered byAlgolia

newContext([options])

Creates and returns a new BrowserContext.

ParameterTypeDefaultDescription
options
objectnull

Returns

TypeDescription
objectBrowserContext object

deviceScaleFactor example

import { chromium } from 'k6/x/browser';
export default function () {
const browser = chromium.launch({
headless: false,
});
const context = browser.newContext({
viewport: {
width: 375,
height: 812,
},
deviceScaleFactor: 3,
});
const page = context.newPage();
page
.goto('https://test.k6.io/', {
waitUntil: 'networkidle',
})
.finally(() => {
page.close();
browser.close();
});
}