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!