How can I add tags to page.goto?

Hi there,

I am new to using k6 browser, however I want to check how long it takes page.goto url
to load the entire page.

This is my current PoC:

   await page.goto("${SOMEURL}", {
            waitUntil: "networkidle"
        });
        page.locator('input[id="username"]').type("user");
        page.locator('input[id="password"]').type("pass");
        const submitButton = page.locator('[id="do-login"]');

        await Promise.all([page.waitForNavigation(), submitButton.click()]);

        await page.goto("${SOMEURL}/department", {
            waitUntil: "networkidle"
        });

So in this example I am logging and I just am visiting the department page, however I know that if I look at the screen during the test, that the loading of the frontend takes at least 5 seconds. (too long)
But I want to quantify it with data to the management team. With the normal K6 you can add tags to requests and see how long it takes, is this also possible for K6 browser as well on url’s?

If I look at the results, I see the whole iteration for this test lasted 17 seconds, however can this be specified on deeper level, which part took the longest?

I get a different reading with Google web vitals then with k6.

The LCP in K6 is being measured after the initial login, rather than the last page go to.

Thanks in advance,

Rody

Hi @rodyb,

We don’t support measuring Webvitals by tags yet. You might follow this issue for updates about this feature. You might also want to do this manually for now, please check out this answer.

The drift between Google and ours is mostly reflected in the LCP metric. The other Webvitals are more or less similar. The test execution environment can make drastic changes. We recommend focusing on the relative trend values rather than the actual values.

Thanks!

2 Likes

Thank you, I will give this a try :slight_smile:

1 Like