When clicking something to open a new tab I get a GO Error

        //Load new page from address
        console.log('stop5')
        const address = await page.locator('[href="Link to new site I only use this for the locator)"]');
        await address.waitFor({ state: 'visible', timeout: 30000 }); // Wait for the element to be visible
        console.log('stop5.05')
        const [page2] = await Promise.all([
            page.waitForNavigation({ timeout: 60000 }), // Wait for navigation
            address.click(), // Click the address
        ]);
        console.log('stop5.06')
        // let pages = context.pages();
        // while (pages.length < 2) {
        //     pages = context.pages();
        // }
        console.log('stop5.06')
        // const page2 = pages[pages.length - 1];
        console.log('stop5.1')
        await page2.bringToFront();```

Am I doing this correctly for opening a new page and using it. I havetried both methods shown there but my logs keep failing after the address button is clicked, this is the Go Error
panic: GoError: handling frameNavigated event to "https://cdn.whatfix.com/prod/77ee1710-b4a0-11e9-ae72-04013d24cd02/1726068871935/modules/customization-bridge/1_5_1/index.html?entID=77ee1710-b4a0-11e9-ae72-04013d24cd02&data-wfx-namespace=embed_77ee1710b4a011e9ae7204013d24cd02&json_message=false&observer_version=1_0_7": we either navigate top level or have old version of the navigated frame
browser   [--------------------------------------] 1 VUs  01m20.0s/30m0s  0/5 iters, 5 per VU
goroutine 17152 [running]:
go.k6.io/k6/js/common.Throw(...)
        go.k6.io/k6/js/common/util.go:17
github.com/grafana/xk6-browser/k6ext.Panic.func1(0x14000464c08, {0x1400c47e840?, 0x103dac901?, 0x140004a40c0?})
        github.com/grafana/xk6-browser@v1.7.0/k6ext/panic.go:35 +0x7c
github.com/grafana/xk6-browser/k6ext.sharedPanic({0x10410bfc8, 0x1400035e0a0}, 0x14004770bd0, {0x1400c47e840, 0x2, 0x2})
        github.com/grafana/xk6-browser@v1.7.0/k6ext/panic.go:64 +0x20c
github.com/grafana/xk6-browser/k6ext.Panic({0x10410bfc8?, 0x1400035e0a0?}, {0x1039986e7?, 0x0?}, {0x1400c47e840?, 0x1400a237d60?, 0x20?})
        github.com/grafana/xk6-browser@v1.7.0/k6ext/panic.go:37 +0x58
github.com/grafana/xk6-browser/common.(*FrameSession).onFrameNavigated(0x14005a324d0, 0x1400b656000, 0x0)
        github.com/grafana/xk6-browser@v1.7.0/common/frame_session.go:772 +0x26c
github.com/grafana/xk6-browser/common.(*FrameSession).initEvents.func1()
        github.com/grafana/xk6-browser@v1.7.0/common/frame_session.go:261 +0x424
created by github.com/grafana/xk6-browser/common.(*FrameSession).initEvents in goroutine 16133
        github.com/grafana/xk6-browser@v1.7.0/common/frame_session.go:224 +0x180

Hi @alexcentorbi07,

Have you tried working with the latest version of k6 (v0.54.0)?

Is there any chance you can share the full script pointing to a publicly accessible website so that I can try to replicate the issue?

Best,
Ankur

I just tried upgrading versions from .53 to .54 and am hitting the same go error. Sadly I cannot share the site but this occurs when I click text that has a href link attached and it opens a new page. No matter how long or how I wait for the new page to open as soon as I try to do an action the go error gets thrown

I did realize the time when this error gets thrown is when my browser doesnt have enough time to print this line in the console
INFO[0073] [errai] aborting startup. bus is not in correct state. (current state: CONNECTED) browser_source=console-api source=browser
If it starts moving before this line, the browser breaks

Hi @alexcentorbi07,

What happens when you run the following script?:

import { browser } from "k6/browser";

export const options = {
  scenarios: {
    ui: {
      executor: "shared-iterations",
      options: {
        browser: {
          type: "chromium",
        },
      },
    },
  }
};

export default async function () {
  const page = await browser.newPage();

  await page.goto("https://k6.io/", { waitUntil: "networkidle" });

  // Click on a link that opens a new tab.
  const browserContext = browser.context();
  await Promise.all([
    browserContext.waitForEvent('page'),
    page.locator('a[href="https://www.thoughtworks.com/radar/tools/k6"]').click()
  ]);

  // Iterate through all the pages and take a screenshot of each, and finally close the page.
  const pages = browserContext.pages();
  for (var i = 0; i < pages.length; i++) {
    await pages[i].waitForLoadState('networkidle');
    await pages[i].screenshot({ path: `screenshot-page${i}.png` });

    await pages[i].close();
  }
}
INFO[0073] [errai] aborting startup. bus is not in correct state. (current state: CONNECTED) browser_source=console-api source=browser

This info console message is coming from your web browser and it’s something being written to with console.log, so possibly your website?

Best,
Ankur