grafana/k6 · info
parsing getAttribute options: %w
Error message
parsing getAttribute options: %w
What it means
Options passed to frame.getAttribute(selector, name, opts) failed to parse (frame_mapping.go:125). Like focus, it uses FrameBaseOptions whose Parse always returns nil - a defensive, effectively unreachable branch in this version.
Source
Thrown at internal/js/modules/k6/browser/browser/frame_mapping.go:125
return nil, fmt.Errorf("parsing focus options: %w", err)
}
return promise(vu, func() (any, error) {
return nil, f.Focus(selector, popts) //nolint:wrapcheck
}), nil
},
"frameElement": func() *sobek.Promise {
return promise(vu, func() (any, error) {
fe, err := f.FrameElement()
if err != nil {
return nil, err //nolint:wrapcheck
}
return mapElementHandle(vu, fe), nil
})
},
"getAttribute": func(selector, name string, opts sobek.Value) (*sobek.Promise, error) {
popts := common.NewFrameBaseOptions(f.Timeout())
if err := popts.Parse(vu.Context(), opts); err != nil {
return nil, fmt.Errorf("parsing getAttribute options: %w", err)
}
return promise(vu, func() (any, error) {
s, ok, err := f.GetAttribute(selector, name, popts)
if err != nil {
return nil, err //nolint:wrapcheck
}
if !ok {
return nil, nil //nolint:nilnil
}
return s, nil
}), nil
},
"getByAltText": func(alt sobek.Value, opts sobek.Value) (*sobek.Object, error) {
if k6common.IsNullish(alt) {
return nil, errors.New("missing required argument 'altText'")
}
palt, popts := parseGetByBaseOptions(vu.Context(), alt, false, opts)
View on GitHub (pinned to 93accf6570)
Solutions
- Pass only { timeout, strict }
- Report to k6 if it fires on a stock build
Defensive patterns
Strategy: try-catch
Validate before calling
const safeOpts = { timeout: Number(opts?.timeout) || undefined, strict: !!opts?.strict }; Try / catch
try {
const v = await frame.getAttribute(sel, name, safeOpts);
if (v == null) console.warn(`${sel} has no attribute ${name}`);
} catch (e) {
console.error(`getAttribute(${sel}, ${name}) failed: ${e.message}`);
} Prevention
- Use only timeout/strict for getAttribute
- Handle the null return (missing attribute) distinctly from errors
When it happens
Trigger: No getAttribute option ({ timeout, strict }) can trigger it today; values are coerced, never rejected.
Common situations: Not seen on stock k6; only relevant to forks or modified parsers.
Related errors
- parsing new frame check options: %w
- parsing double click options: %w
- parsing frame dispatch event options: %w
- parsing fill options: %w
- parsing focus options: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/67249b839ce37117.
Report an issue: GitHub.