Hello,
When I run my test script specifying vus and duration I get the following error:
CMD: k6 run --vus 2 --duration 10s script2.js
Errors:
ERRO[0000] Uncaught (in promise) GoError: browser not found in registry. make sure to set browser type option in scenario definition in order to use the browser module default at github.com/grafana/xk6-browser/browser.mapBrowser.func6 (native)
My code:
import { htmlReport } from âK6 Load Test: <%= title %>â;
import { browser } from âk6/experimental/browserâ;
import { check } from âk6âexport const options = {
scenarios: {
ui: {
executor: âshared-iterationsâ,
options: {
browser: {
type: âchromiumâ
}
}
}
}
}export default async function () {
const page = browser.newPage()await page.goto(âhttps://otel-demo.field-eng.grafana.net/â)
const productCard = page.locator(â(//div[@data-cy=âproduct-cardâ])[1]â)
await productCard.click()const quantityOption = page.locator(â[data-cy=âproduct-quantityâ]â)
quantityOption.selectOption(â3â)const addToCardBtn = page.locator(â[data-cy=âproduct-add-to-cartâ]â)
await addToCardBtn.click()check(page, {
âcart item nameâ: page => page.locator(â//p[text()=âNational Park Foundation Explorascopeâ]â).isVisible() === true,
âcart item quantityâ: page => page.locator(â//p[text()=â3â]â).isVisible() === true
})page.close()
}export function handleSummary(data) {
return {
âTestSummaryReport.htmlâ: htmlReport(data, { debug: true })
};
}
If I run it normally without specifying vus and duration, the error doesnât occur.
I did not find anything similar here on the forum, I will be very happy to receive help.