grafana/k6 · error

parsing isDisabled options of selector

Error message

parsing isDisabled options of selector %q: %w

What it means

Thrown when `frame.isDisabled(selector, opts)` gets an options object that fails to parse into FrameIsDisabledOptions (FrameBaseOptions: `strict`, `timeout` ms), with the selector quoted in the message. The current Parse cannot fail (coercive conversions), making this a defensive wrapper.

Solutions

  1. Pass real booleans for strict: { strict: true } — not 'true'/'false' strings
  2. Keep timeout numeric in milliseconds
  3. Rely on the selector in the error text to find the offending call if it ever fires

Example fix

// before
await frame.isDisabled('#btn', { strict: 'false' }); // coerces to true!

// after
await frame.isDisabled('#btn', { strict: false });
Defensive patterns

Strategy: try-catch

Validate before calling

const opts = { timeout: 2000 };
if (Object.keys(opts).some(k => !['strict', 'timeout'].includes(k))) console.warn('unknown isDisabled option keys will be ignored');

Type guard

function isFrameBaseOptions(o) {
  return o == null || (typeof o === 'object' &&
    (o.strict === undefined || typeof o.strict === 'boolean') &&
    (o.timeout === undefined || typeof o.timeout === 'number'));
}

Try / catch

try {
  await frame.isDisabled(sel, opts);
} catch (e) {
  if (String(e).includes('parsing isDisabled options')) { /* fix opts for this selector */ } else { throw e; }
}

Prevention

When it happens

Trigger: No runtime input triggers it today; only a stricter Parse would. Wrongly typed `strict`/`timeout` values are coerced, unknown keys dropped.

Common situations: Copy-pasted option bags from Playwright; boolean-ish strings for strict ('false' coerces to true because non-empty string ToBoolean is true — a silent logic trap).

Related errors


AI-assisted analysis of grafana/k6@8d06114777 (2026-09-14). Data as JSON: /api/errors/26a79b494e7ecbec. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/browser/frame_mapping.go:265

			}
			return promise(vu, func() (any, error) {
				return f.InputValue(selector, popts) //nolint:wrapcheck
			}), nil
		},
		"isChecked": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameIsCheckedOptions(rt, opts, f.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing isChecked options of selector %q: %w", selector, err)
			}
			return promise(vu, func() (any, error) {
				return f.IsChecked(selector, popts) //nolint:wrapcheck
			}), nil
		},
		"isDetached": f.IsDetached,
		"isDisabled": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameIsDisabledOptions(rt, opts, f.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing isDisabled options of selector %q: %w", selector, err)
			}
			return promise(vu, func() (any, error) {
				return f.IsDisabled(selector, popts) //nolint:wrapcheck
			}), nil
		},
		"isEditable": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameIsEditableOptions(rt, opts, f.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parse isEditable options of selector %q: %w", selector, err)
			}
			return promise(vu, func() (any, error) {
				return f.IsEditable(selector, popts) //nolint:wrapcheck
			}), nil
		},
		"isEnabled": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameIsEnabledOptions(rt, opts, f.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parse isEnabled options of selector %q: %w", selector, err)

View on GitHub (pinned to 8d06114777)