Unable to run k6 Browser tests in headful mode on Windows 11 – `K6_BROWSER_HEADLESS=false` is being ignored

Hi k6 team,

I’m trying to run browser-based tests using the k6 browser module. According to the docs and Playwright/Puppeteer experience, setting the browser to run in headful mode (i.e., visible browser window) should be possible by setting either headless: false in the launch options or the environment variable K6_BROWSER_HEADLESS=false.

Here is my setup:

import { browser } from ‘k6/browser’;
import { check } from ‘k6’;

export const options = {
scenarios: {
ui: {

        executor: 'shared-iterations',
        vus: 5, // 🔥 Simulate 20 virtual users
        iterations: 5, // ⏱️ Run for 30 seconds
        options: {
            browser: {
                type: 'chromium'
            }
        },
    },
},

};

export default async function () {
const page = await browser.newPage();

try {
    await page.goto('https://test.k6.io/my_messages.php');

    // Enter login credentials
    await page.locator('input[name="login"]').type('admin');
    await page.locator('input[name="password"]').type('123');
    await page.locator('[type="submit"]').click();
    await page.waitForTimeout(1000); // Wait for 1 second
    await page.screenshot({ path: 'screenshots/screenshot.png' });

    check(page.url(), {
        'Login successful': (url) => url.includes('admin.php'),
    });
} finally {
    await page.close();
}

}

And I run the script with:
set "K6_BROWSER_HEADLESS=false" && k6 run script.js

Issue:
No browser UI appears. The browser still runs in headless mode, even though I have tried both the environment variable and the headless: false option in code. This is different from the behavior I get with Playwright or Puppeteer, where headless: false launches the browser with a visible window.


  • Is there a limitation in k6 browser that prevents running in headful mode?
  • Is this feature not supported, or am I missing some configuration?
  • If not supported, is there any roadmap for adding headful (non-headless) mode for debugging?

Any clarification would be really appreciated. Thank you!


System info:

  • OS: Windows 11
  • k6 version: k6.exe v1.0.0 (commit/41b4984b75, go1.24.2, windows/amd64)
  • Node version: v20.18.1

Thanks in advance!

Hi @salmansrabon,

Welcome to our community forums! :tada:

As far as I can get from Browser options | Grafana k6 documentation, it seems to me that you can only disable headless mode through environment variables. Concretely, by setting K6_BROWSER_HEADLESS equals to false.

I tested it both in MacOS, and in a VM running Win11 and for me it worked with both.

However, it’s true that in my case, set "K6_BROWSER_HEADLESS=false" didn’t do the job to set up the environment variable. I guess the concrete syntax really depends on what terminal system (PowerShell vs others) are you using, or whether WSL is installed in your system or not.

In my case, with PowerShell, it’s $env:K6_BROWSER_HEADLESS = "false" what really set it.

So, I’m wondering if that might be your case. I guess you could check it by adding a console.log statement like: console.log(__ENV.K6_BROWSER_HEADLESS);, and checking whether the environment variable is really being defined or not.

Once you have made sure the environment variable is correctly set to false, try again, please.
If it still doesn’t work, could you please tell me what version of Chromium are you using, so I can try to reproduce it?

I hope that helps! :crossed_fingers:

Thanks! :person_bowing: