grafana/k6 · error
unexpected type %T (expecting string)
Error message
unexpected type %T (expecting string)
What it means
Error "unexpected type %T (expecting string)" thrown in grafana/k6.
Source
Thrown at internal/js/modules/k6/browser/common/frame.go:1025
func (f *Frame) getAttribute(selector, name string, opts *FrameBaseOptions) (string, bool, error) {
getAttribute := func(apiCtx context.Context, handle *ElementHandle) (any, error) {
return handle.getAttribute(apiCtx, name)
}
act := f.newAction(
selector, DOMElementStateAttached, opts.Strict, getAttribute,
[]string{}, false, withRetry, true, opts.Timeout,
)
v, err := call(f.ctx, act, opts.Timeout)
if err != nil {
return "", false, errorFromDOMError(err)
}
if v == nil {
return "", false, nil
}
s, ok := v.(string)
if !ok {
return "", false, fmt.Errorf("unexpected type %T (expecting string)", v)
}
return s, true, nil
}
// GetByRole creates and returns a new locator for this frame using the ARIA role
// and any additional options.
func (f *Frame) GetByRole(role string, opts *GetByRoleOptions) *Locator {
f.log.Debugf("Frame:GetByRole", "fid:%s furl:%q role:%q opts:%+v", f.ID(), f.URL(), role, opts)
return f.Locator(f.buildRoleSelector(role, opts), nil)
}
// isQuotedText returns true if the string is a quoted string.
// This is used to determine if the string will be used to match
// a string instead of as a regex in the getBy* APIs. It handles
// both single and double quotes.
func isQuotedText(s string) bool {View on GitHub (pinned to 93accf6570)
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame.go:1025 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/03945e1a28dc623f.
Report an issue: GitHub.