Surya
1
Hi
I keep getting this error when i run even a sample K6 browser script
Can you please help ?
import { browser } from ‘k6/experimental/browser’;
import { check } from ‘k6’;
export const options = {
scenarios: {
ui: {
executor: ‘shared-iterations’,
options: {
browser: {
type: ‘chromium’,
},
},
},
},
thresholds: {
checks: [“rate==1.0”]
}
}
export default async function () {
const context = browser.newContext();
const page = context.newPage();
try {
await page.goto(‘My messages’);
page.locator('input[name="login"]').type('admin');
page.locator('input[name="password"]').type('123');
const submitButton = page.locator('input[type="submit"]');
await Promise.all([page.waitForNavigation(), submitButton.click()]);
check(page, {
'header': p => p.locator('h2').textContent() == 'Welcome, admin!',
});
} finally {
page.close();
}
}
Welcome @Surya , Which version k6 installed on local machine? Can show console error after running script?
Surya
3
k6 v0.46.0 ((devel), go1.21.0, darwin/arm64)
K6_Scripts % K6_BROWSER_ENABLED=true k6 run Debug_Browser.js
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| _\ ____/ .io
execution: local
script: Debug_Browser.js
output: -
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* ui: 1 iterations shared among 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)
ERRO[0000] process with PID 22111 unexpectedly ended: exit status 126 category=browser elapsed=“0 ms” source=browser
✓ checks…: 0.00% ✓ 0 ✗ 0
data_received…: 0 B 0 B/s
data_sent…: 0 B 0 B/s
iteration_duration…: avg=50.62µs min=50.62µs med=50.62µs max=50.62µs p(90)=50.62µs p(95)=50.62µs
iterations…: 1 192.826841/s
running (00m00.0s), 0/1 VUs, 0 complete and 1 interrupted iterations
ui ✗ [======================================] 1 VUs 00m00.0s/10m0s 1/1 shared iters
ERRO[0000] error building browser on IterStart: launching browser: browser process ended unexpectedly at file: