grafana/k6 · error
parsing double click options: %w
Error message
parsing double click options: %w
What it means
The options object passed to frame.dblclick(selector, opts) failed to parse (frame_mapping.go:55). ElementHandleDblclickOptions parses 'position' (must be {x: number, y: number}) and 'modifiers' (must be an array of strings); either failing to export throws this error synchronously.
Source
Thrown at internal/js/modules/k6/browser/browser/frame_mapping.go:55
popts, err := parseFrameClickOptions(vu.Context(), opts, f.Timeout())
if err != nil {
return nil, err
}
return promise(vu, func() (any, error) {
err := f.Click(selector, popts)
return nil, err //nolint:wrapcheck
}), nil
},
"content": func() *sobek.Promise {
return promise(vu, func() (any, error) {
return f.Content() //nolint:wrapcheck
})
},
"dblclick": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts := common.NewFrameDblClickOptions(f.Timeout())
if err := popts.Parse(vu.Context(), opts); err != nil {
return nil, fmt.Errorf("parsing double click options: %w", err)
}
return promise(vu, func() (any, error) {
return nil, f.Dblclick(selector, popts) //nolint:wrapcheck
}), nil
},
"dispatchEvent": func(selector, typ string, eventInit, opts sobek.Value) (*sobek.Promise, error) {
popts := common.NewFrameDispatchEventOptions(f.Timeout())
if err := popts.Parse(vu.Context(), opts); err != nil {
return nil, fmt.Errorf("parsing frame dispatch event options: %w", err)
}
earg := exportArg(eventInit)
return promise(vu, func() (any, error) {
return nil, f.DispatchEvent(selector, typ, earg, popts) //nolint:wrapcheck
}), nil
},
"evaluate": func(pageFunc sobek.Value, gargs ...sobek.Value) (*sobek.Promise, error) {
if sobekEmptyString(pageFunc) {
return nil, fmt.Errorf("evaluate requires a page function")View on GitHub (pinned to 93accf6570)
Solutions
- Use { modifiers: ['Alt', 'Shift'] } and { position: { x: 10, y: 20 } }
- Split string modifiers before the call: { modifiers: raw.split(',') }
- Coerce positions from strings: { position: { x: Number(p.x), y: Number(p.y) } }
Example fix
// before
frame.dblclick('#row', { modifiers: 'Shift', position: [5, 5] });
// after
frame.dblclick('#row', { modifiers: ['Shift'], position: { x: 5, y: 5 } }); Defensive patterns
Strategy: type-guard
Validate before calling
const norm = {
...opts,
...(opts?.modifiers && !Array.isArray(opts.modifiers) ? { modifiers: String(opts.modifiers).split(',') } : {}),
...(opts?.position ? { position: { x: Number(opts.position.x), y: Number(opts.position.y) } } : {}),
}; Type guard
function isDblclickOptions(o) {
if (o == null) return true;
const posOk = o.position == null || (typeof o.position === 'object' && !Array.isArray(o.position)
&& Number.isFinite(Number(o.position.x)) && Number.isFinite(Number(o.position.y)));
const modOk = o.modifiers == null || (Array.isArray(o.modifiers) && o.modifiers.every(m => typeof m === 'string'));
return posOk && modOk;
} Try / catch
try {
await frame.dblclick(sel, norm);
} catch (e) {
if (String(e.message).includes('parsing double click options')) throw new Error(`bad dblclick opts for ${sel}: ${JSON.stringify(opts)}`);
throw e;
} Prevention
- modifiers is an array of strings; position is {x, y} numbers
- Normalize once at the config boundary instead of at each call site
- Reuse one shared option-validator for click, dblclick, and hover
When it happens
Trigger: frame.dblclick('#el', { position: '10,10' }) or { modifiers: 'Shift' } (string instead of array) - the sobek ExportTo into map[string]float64 or []string fails and the wrapper adds 'parsing double click options:'.
Common situations: Reusing mouse-action option objects where modifiers were stored as a comma-separated string; ported Playwright snippets with tuple positions; config-driven option objects where types loosen at the JSON boundary.
Related errors
- parsing new frame check options: %w
- parsing frame dispatch event options: %w
- evaluate requires a page function
- evaluateHandle requires a page function
- parsing fill options: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/1a37cd2f971839e6.
Report an issue: GitHub.