After k6 version 0.46 upgrade, browser is not invoked

Hi folks,
I just upgrade my k6 from 0.45 to 0.46. Suddenly the browser is not invoked.
I run the sample code that come with the release. The test runs ok. But the browser is not visible.
import { browser } from ‘k6/experimental/browser’;

export const options = {
scenarios: {
ui: {
executor: ‘shared-iterations’,
options: {
browser: {
type: ‘chromium’, // chromium is the only supported browser type so as long as
// the option is set, Chromium/Google Chrome will be used
},
},
},
},
};

export default async function () {
const page = browser.newPage();
try {
await page.goto(‘https://grafana.com’);
console.log(“TESTING…”);
} finally {
page.close();
}
}

Any idea why?

Thanks,
-Madison

Hi @madisonli

What do you mean with:

Suddenly the browser is not invoked.
I run the sample code that come with the release. The test runs ok. But the browser is not visible.

? Do you mean that the browser GUI is not visible in your screen?
By default the browser is launched in headless mode. This can be controlled through K6_BROWSER_HEADLESS environment variable. See here for browser level options. Is this what you are referring to?

Can you post here the output of the script please?

2 Likes

Thanks Daniel. It was my bad.

Typo in command: “k6 run -e K6_BROWSER_HEADless=false temp.js”

It works with command “k6 run -e K6_BROWSER_HEADLESS=false temp.js”