K6 Browser Load Testing - Getting Error while logging in web application

87 Views Asked by At

I am trying to implement K6 browser chromium, when I try to logging in, getting error, please check and provide your inputs.

Error Details

ERRO[0003] "Cannot read properties of undefined (reading 'type')" browser_source=console-api source=browser ERRO[0003] "TypeError: Cannot read properties of undefined (reading 'type')\n
ERRO[0004] Uncaught (in promise) clicking on "input[type="submit"]": context canceled executor=shared-iterations scenario=browse

k6 code

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();
try {
await page.goto('https://www.mywebsite.com/login/');
page.locator('input[id="username"]').type('username');
page.locator('input[id="password"]').type('password');    
const submitButton = page.locator('input[type="submit"]');
await Promise.all([
page.waitForNavigation(),
submitButton.click(),
]);
check(page, {
header': page.locator('h2').textContent() == 'Welcome, admin!',
});
} finally {
page.screenshot({ path: 'login.png' });
page.close();
}
}

why the error is getting

0

There are 0 best solutions below