How can I get the browser metrics for each page?

Hi! I’m new in k6 ) Have a question:
Is there any way to get browser metrics in k6 cloud or Grafana for each page?
my script is

const pages = ['page1','page2','page3','page4']

export default function () {
 const browser = launcher.launch("chromium", {
  headless: false,
  timeout: "60s"
});

 pages.forEach(innerPage => { 
   const context = browser.newContext({
    ignoreHTTPSErrors: true,
    JavaScriptEnabled: true,
    headless: false,
    devtools: false,
    bypassCSP: true
  });
   const page = context.newPage();

   page.goto(baseUrl+innerPage, { waitUntil: "networkidle" });

   page.waitForNavigation();
   page.waitForLoadState("networkidle");
   page.$('[data-testid="username-input"]').type(login);
   page.$('[data-testid="password-input"]').type(password);
   page.$('[data-testid="submit-button"]').click();

   page.close();
 })
 browser.close();
}

but I’ve got only average metrics for all pages
Thanks!

Hi Kate, welcome to the forum :slight_smile:

Currently it’s not possible to view browser metrics per page in k6 Cloud, but we’re working on it and it should be available soon.

It should be possible to query them in Grafana though. How are you running the script?

You can also use the JSON output and see the metrics for all pages individually that way. See this related answer for more information.

thanks for the clarification @imiric !
now I’m running script locally with --out cloud
and Grafana is connected to k6 cloud using API key
In Grafana I created a new panel on the Dashboard, but when select a URL in the query I see only API-urls

Hey @Kate,
Cloud APM only works if the test runs on the cloud, so --out cloud doesn’t trigger sending of metrics via Cloud APM, because it runs locally and we can’t control the test.

ohh…thanks a lot @mostafa!