K6-Browser Testing

Hi Guys,

I have a K6 script for browser testing. It’s working fine and good.

However when I scale the number of instances of browser the browser gets closed in between the test. I have increased by system configuration to 32GB RAM, 128 memory and 500GB Disk.

I’m not sure what I’m missing please let me know what can be done to fix this.


Hi @vasanthkumarmf2,

when I scale the number of instances of browser

Can you tell us how you’re doing that?

Could you please send your script here?


import { check, sleep, html } from 'k6';
import { browser } from 'k6/experimental/browser';
import { SharedArray } from 'k6/data';
import { group } from 'k6';
import { loginfunction } from './login.js';
import { logoutfunction } from './logout.js';
import { doublemateriality } from './doublemateriality.js';

export const options = {
    scenarios: {
        ui: {
            executor: 'per-vu-iterations',
            vus: 5,
            tags: { test_name: 'Application Assesment'},
            options: {
                browser: {
                    type: 'chromium',
    thresholds: {
        checks: ["rate==1.0"]

const data = new SharedArray('some data name', function () {
    return JSON.parse(open('./data-qa.json')).users;

export default async function () {

    const page = browser.newPage();
    const user = data[0];

    const currentTime = getCurrentTime();
    const randomNumber = Math.floor(Math.random() * 10) + 1;

    group('01_Application entry', function () {
        const submitButton = page.locator('//*[@id="main_login_body"]/div/ul/li/picture');

    loginfunction(page, data, randomNumber);

    doublemateriality(page, getCurrentTime);


catch (error) {
    console.error('Error parsing JSON data:', error);


function getCurrentTime() {
    const now = new Date();
    const hours = String(now.getHours()).padStart(2, '0');
    const minutes = String(now.getMinutes()).padStart(2, '0');
    const seconds = String(now.getSeconds()).padStart(2, '0');

    return `${hours}:${minutes}:${seconds}`;

Hi @inancgumus ,

The above is my partial script. and the step in line 13 vus=5 is used to increased the number of chrome instances all the once. It’s launching as expexted, however its getting closed intermitently.

1 Like


We also need an HTML snippet to run this test script with to reproduce the problem, as we couldn’t produce the problem with this test script.


Hi @inancgumus,

Thanks for the concern. However this is our clients application we are testing I cannot post the entire script in open forum. If possible can we have a screenshare session? If yes please let me know your avaialble timings. That would be a great help!


Hi @vasanthkumarmf2,

We only need a snippet that reproduces this problem. We don’t need the entire client application. What do you think?