No results for

Powered byAlgolia

Allows you to access all open BrowserContexts.

Returns

TypeDescription
ArrayArray of BrowserContext objects

Example

import { chromium } from 'k6/x/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();
}