grafana/k6 · error
parse isChecked options of selector
Error message
parse isChecked options of selector %q: %w
What it means
Thrown synchronously by page.isChecked(selector, opts) when the underlying parse fails. FrameIsCheckedOptions embeds FrameBaseOptions, whose Parse (internal/js/modules/k6/browser/common/frame_options.go:218-232) reads only strict/timeout, coerces both and always returns nil — so on stock k6 this message is defensive/unreachable. The wrapper is notable for including the selector in the message, unlike most siblings.
Solutions
- Keep opts to { strict: boolean, timeout: numberMs }
- Omit opts for default behavior
- Use the selector echoed in the message to locate the offending call site in loops
Example fix
// before
await page.isChecked('#opt-in', { timeout: '1s' });
// after
await page.isChecked('#opt-in', { timeout: 1000 }); Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = new Set(['timeout', 'strict']);
const bad = Object.keys(opts ?? {}).filter(k => !ALLOWED.has(k));
if (bad.length) console.warn(`isChecked ignores unknown options: ${bad.join(', ')}`);
if (opts?.timeout !== undefined && !Number.isInteger(opts.timeout)) {
throw new Error('isChecked timeout must be integer milliseconds');
}
await page.isChecked(selector, opts); Type guard
/** @param {unknown} o */
function isBaseOpts(o) {
if (o === undefined || o === null) return true;
if (typeof o !== 'object') return false;
const t = /** @type {any} */ (o);
return (t.timeout === undefined || Number.isInteger(t.timeout))
&& (t.strict === undefined || typeof t.strict === 'boolean');
} Try / catch
try {
return await page.isChecked(selector, opts);
} catch (e) {
if (String(e).includes('isChecked options')) {
return await page.isChecked(selector);
} throw e;
} Prevention
- isChecked accepts only timeout and strict
- The message includes the selector — use it to find the bad call in loops
- Keep boolean-check option objects minimal or omit them
When it happens
Trigger: Not reachable with current stock code; a custom parser validating strict/timeout types could raise it, naming the offending selector.
Common situations: Custom xk6 builds with stricter validation; version drift.
Related errors
- parse isDisabled options of selector
- parse isEditabled options of selector
- parse isEnabled options of selector
- parse isHidden options of selector
- parsing double click options
AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14).
Data as JSON: /api/errors/0ee8728ac2f1e793.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:291
return nil, fmt.Errorf("parsing inner text options: %w", err)
}
return promise(vu, func() (any, error) {
return p.InnerText(selector, popts) //nolint:wrapcheck
}), nil
},
"inputValue": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameInputValueOptions(rt, opts, p.MainFrame().Timeout())
if err != nil {
return nil, fmt.Errorf("parsing input value options: %w", err)
}
return promise(vu, func() (any, error) {
return p.InputValue(selector, popts) //nolint:wrapcheck
}), nil
},
"isChecked": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameIsCheckedOptions(rt, opts, p.MainFrame().Timeout())
if err != nil {
return nil, fmt.Errorf("parse isChecked options of selector %q: %w", selector, err)
}
return promise(vu, func() (any, error) {
return p.IsChecked(selector, popts) //nolint:wrapcheck
}), nil
},
"isClosed": p.IsClosed,
"isDisabled": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameIsDisabledOptions(rt, opts, p.MainFrame().Timeout())
if err != nil {
return nil, fmt.Errorf("parse isDisabled options of selector %q: %w", selector, err)
}
return promise(vu, func() (any, error) {
return p.IsDisabled(selector, popts) //nolint:wrapcheck
}), nil
},
"isEditable": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameIsEditableOptions(rt, opts, p.MainFrame().Timeout())
if err != nil {View on GitHub (pinned to 8d06114777)