Trying to use the browser module but getting this error:
ERRO[0001] Uncaught (in promise) browser not found in registry. make sure to set browser type option in scenario definition in order to use the browser module
Running k6 on Windows 10, version:
k6.exe v0.52.0 (go1.22.2, windows/amd64)
Extensions:
xk6-output-influxdb v0.4.3, xk6-influxdb [output]
xk6-sql v0.4.0, k6/x/sql [js]
I run it like this:
k6 run .\BrowserTest.js
This is my script
import { browser } from ‘k6/browser’;
let sharedContext;
export const options = {
scenarios: {
ui: {
executor: ‘shared-iterations’,
options: {
browser: {
type: ‘chromium’,
},
},
},
}
};export function setup() {
sharedContext = browser.newContext();
}export default async function () {
const page = await browser.newPage();
try {
await page.goto(‘https://test.k6.io/’);
} finally {
page.close();
}
}export function teardown() {
sharedContext.close();
}
2 posts - 2 participants