grafana/k6 · error
parsing set checked options
Error message
parsing set checked options: %w
What it means
Thrown while parsing the options object of locator.setChecked(checked, options) (browser/locator_mapping.go:112). FrameCheckOptions.Parse delegates to ElementHandleBasePointerOptions.Parse, whose only failing branch is position: it must export to a map with numeric x/y. strict, force, noWaitAfter, trial and timeout are coerced and cannot fail; the checked boolean itself is a separate positional argument.
Solutions
- Use position: { x: 5, y: 5 } with numbers
- Remove position to click the element center
- Coerce with Number() when values come from external sources
- If the label intercepts clicks, prefer force: true or a position on the input box itself
Example fix
// before
locator.setChecked(true, { position: [5, 5] });
// after
locator.setChecked(true, { position: { x: 5, y: 5 } }); Defensive patterns
Strategy: validation
Validate before calling
if (opts?.position != null &&
!(typeof opts.position === 'object' && typeof opts.position.x === 'number' && typeof opts.position.y === 'number')) {
throw new Error('position must be { x: number, y: number }');
} Type guard
function isCheckOptions(o) {
if (o == null) return true;
if (typeof o !== 'object' || Array.isArray(o)) return false;
const p = o.position;
return p == null || (typeof p === 'object' && typeof p.x === 'number' && typeof p.y === 'number');
} Try / catch
try { await locator.setChecked(true, opts); } catch (e) { if (!String(e.message).includes('parsing set checked options')) throw e; } Prevention
- Position is always { x, y } numbers — never an array or named string
- For overlapped checkboxes prefer a numeric offset on the input or force: true
- Centralize checkbox-option construction so both check and setChecked share a validated shape
When it happens
Trigger: locator.setChecked(true, { position: [5, 5] }); locator.setChecked(false, { position: 'topLeft' }); coordinates from JSON/env arriving as strings on the export path.
Common situations: Checkbox automation where the label overlaps the input and a position offset is used; porting Playwright scripts that pass arrays; data-driven coordinates serialized through config.
Related errors
- parsing check options
- parsing double click options
- parsing clear options
- parsing frame set check options
- parsing frame uncheck options
AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14).
Data as JSON: /api/errors/bf1711b458f27e1a.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/locator_mapping.go:113
},
"evaluateHandle": func(pageFunc sobek.Value, gargs ...sobek.Value) (*sobek.Promise, error) {
if sobekEmptyString(pageFunc) {
return nil, fmt.Errorf("evaluateHandle requires a page function")
}
funcString := pageFunc.String()
gopts := exportArgs(gargs)
return promise(vu, func() (any, error) {
jsh, err := lo.EvaluateHandle(funcString, gopts...)
if err != nil {
return nil, err //nolint:wrapcheck
}
return mapJSHandle(vu, jsh), nil
}), nil
},
"setChecked": func(checked bool, opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameCheckOptions(rt, opts, lo.Timeout())
if err != nil {
return nil, fmt.Errorf("parsing set checked options: %w", err)
}
return promise(vu, func() (any, error) {
return nil, lo.SetChecked(checked, copts) //nolint:wrapcheck
}), nil
},
"check": func(opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameCheckOptions(rt, opts, lo.Timeout())
if err != nil {
return nil, fmt.Errorf("parsing check options: %w", err)
}
return promise(vu, func() (any, error) {
return nil, lo.Check(copts) //nolint:wrapcheck
}), nil
},
"uncheck": func(opts sobek.Value) (*sobek.Promise, error) {
copts, err := parseFrameUncheckOptions(rt, opts, lo.Timeout())
if err != nil {
return nil, fmt.Errorf("parsing uncheck options: %w", err)View on GitHub (pinned to 8d06114777)