grafana/k6 · error
parse isDisabled options of selector
Error message
parse isDisabled options of selector %q: %w
What it means
Thrown synchronously by page.isDisabled(selector, opts) when FrameIsDisabledOptions.Parse fails. The embedded FrameBaseOptions.Parse (internal/js/modules/k6/browser/common/frame_options.go:218-232) coerces strict/timeout and always returns nil, so on stock k6 this wrapper cannot fire; invalid timeout values coerce to 0ms instead of erroring. The selector is included in the message.
Solutions
- Pass only strict and timeout (integer ms)
- Omit opts entirely
- Match your build's option schema if customized
Example fix
// before
await page.isDisabled('#btn', { timeout: '1s' });
// after
await page.isDisabled('#btn', { 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(`isDisabled ignores unknown options: ${bad.join(', ')}`);
if (opts?.timeout !== undefined && !Number.isInteger(opts.timeout)) {
throw new Error('isDisabled timeout must be integer milliseconds');
}
await page.isDisabled(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.isDisabled(selector, opts);
} catch (e) {
if (String(e).includes('isDisabled options')) {
return await page.isDisabled(selector);
} throw e;
} Prevention
- isDisabled reads only timeout and strict
- Integer milliseconds for timeout, never strings
- Reuse one shared option constant across the is* family
When it happens
Trigger: Not reachable with current stock code; would require a build whose FrameBaseOptions.Parse validates types.
Common situations: Forked browser modules or newer versions with added type validation.
Related errors
- parse isChecked 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/1db77a96a368e120.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:301
}
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 {
return nil, fmt.Errorf("parse isEditabled options of selector %q: %w", selector, err)
}
return promise(vu, func() (any, error) {
return p.IsEditable(selector, popts) //nolint:wrapcheck
}), nil
},
"isEnabled": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts, err := parseFrameIsEnabledOptions(rt, opts, p.MainFrame().Timeout())
if err != nil {
return nil, fmt.Errorf("parse isEnabled options of selector %q: %w", selector, err)View on GitHub (pinned to 8d06114777)