Unable to see Total Requests in HTML report or console for browser performance testing in K6

Hi All,

I am not seeing Total requests in HTML report or in the default command prompt logs after running below browser performance testing code. Pleae help me with any missing criteria etc.

import { browser } from 'k6/browser';
import { sleep } from 'k6';
import { htmlReport } from 'https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js';

export const options = {
  scenarios: {
    HomePageTestOnBrowser: {
      executor: 'per-vu-iterations',
      vus: 5, // Number of virtual users
      iterations: 1, // Number of iterations per virtual user
      options: {
        browser: {
          type: 'chromium',
          headless: true,
        },
      },
    },
  }
};

// Global counter variable
let totalRequests = 0;

export default async function () {
  const page = await browser.newPage();
  try {
    const response = await page.goto('https://google.com/', { waitUntil: 'networkidle', timeout: 60000 });
    sleep(4);
    console.log('Status Code:', response.status());

    // Increment the counter
    totalRequests += 1;
  } finally {
    await page.close();
  }
}

// Log the total number of requests at the end of the test
export function handleSummary(data) {
  console.log(`Total Requests: ${totalRequests}`);
  return {
    'reportPageLoad.html': htmlReport(data),
  };
}


Hi @bharatj903,

The html report you are referring to is from a third-party so maybe it is better question for their issues . It also happens to not have been updated in 3 years.

My expectation is that they just show http_request* metrics as requests in the report. But browser doesn’t emit http_request* metrics, only k6/http does. You can look at what metrics browser emits in docs.

I would probably recommend using the web dashboard instead of the html report as well.

Hope this helps you!

2 Likes

thank you it helped.