grafana / xk6-browser

The browser module adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol to k6.
https://grafana.com/docs/k6/latest/javascript-api/k6-browser/
GNU Affero General Public License v3.0
344 stars 41 forks source link

panic on getting title #1539

Closed mstoykov closed 2 hours ago

mstoykov commented 2 hours ago

Brief summary

panic: interface conversion: interface {} is nil, not string

goroutine 4505318 [running]:
github.com/grafana/xk6-browser/common.(*Frame).Title(0xc048f0e540)
github.com/grafana/xk6-browser@v1.9.1/common/frame.go:1748 +0x132
github.com/grafana/xk6-browser/browser.mapFrame.func34.1()
github.com/grafana/xk6-browser@v1.9.1/browser/frame_mapping.go:233 +0x17
github.com/grafana/xk6-browser/k6ext.promise.func1()
github.com/grafana/xk6-browser@v1.9.1/k6ext/promise.go:24 +0x2c
created by github.com/grafana/xk6-browser/k6ext.promise in goroutine 409
github.com/grafana/xk6-browser@v1.9.1/k6ext/promise.go:23 +0x9a

xk6-browser version

v1.9.1

OS

linux

Chrome version

-

Docker version and image (if applicable)

No response

Steps to reproduce the problem

import { browser } from "k6/browser";

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

export default async function() {
    const context = await browser.newContext();
    const page = await context.newPage();
    page.frames()[0].title()
    console.log("here", page.mainFrame.title());
}

Seems to make it break in the same way - all lines seem to be improtant

Expected behaviour

no panic

Actual behaviour

panic

mstoykov commented 2 hours ago

This was fixed in 77a5872aa40b07e4338da44f226232c5946a2a48 but there was apperantly no issue that I can find.