grafana/k6 · error

parsing frame set check options

Error message

parsing frame set check options: %w

What it means

Thrown when `frame.setChecked(selector, checked, opts)` options fail to parse into FrameCheckOptions, which embeds pointer options. Real failure point: `position` must export to a map of numbers ({ x, y }) — strings like 'center' or string coordinates fail rt.ExportTo and surface as "parsing frame set check options: <cause>". Other keys (force, noWaitAfter, timeout, trial, strict) are coercive.

Solutions

  1. Pass position as { x: <number>, y: <number> }
  2. Omit position — the element center is used by default
  3. Check the wrapped sobek conversion error for the exact key that failed

Example fix

// before
await frame.setChecked('#agree', true, { position: { x: '10', y: '10' } });

// after
await frame.setChecked('#agree', true, { position: { x: 10, y: 10 } });
Defensive patterns

Strategy: validation

Validate before calling

function assertSetCheckedOpts(opts = {}) {
  if (opts.position !== undefined) {
    const { x, y } = opts.position ?? {};
    if (typeof x !== 'number' || typeof y !== 'number') throw new Error('position must be { x: number, y: number }');
  }
}

Type guard

function isPosition(p) {
  return p == null || (typeof p === 'object' && typeof p.x === 'number' && typeof p.y === 'number');
}

Try / catch

try {
  await frame.setChecked(sel, true, opts);
} catch (e) {
  if (String(e).includes('parsing frame set check options')) { console.error('check position/modifiers shape'); throw e; }
  throw e;
}

Prevention

When it happens

Trigger: `frame.setChecked('#cb', true, { position: 'center' })` or `{ position: { x: '5', y: 5 } }` — the ExportTo(map[string]float64) conversion fails.

Common situations: Porting Playwright setChecked snippets with string pixel values; using position on tiny checkbox elements where pixel-exact coordinates were copied from devtools with units attached.

Related errors


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

Appendix: source

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

		"selectOption": func(selector string, values sobek.Value, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameSelectOptionOptions(rt, opts, f.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing select option options: %w", err)
			}

			convValues, err := ConvertSelectOptionValues(rt, values)
			if err != nil {
				return nil, fmt.Errorf("parsing select options values: %w", err)
			}

			return promise(vu, func() (any, error) {
				return f.SelectOption(selector, convValues, popts) //nolint:wrapcheck
			}), nil
		},
		"setChecked": func(selector string, checked bool, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameCheckOptions(rt, opts, f.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing frame set check options: %w", err)
			}

			return promise(vu, func() (any, error) {
				return nil, f.SetChecked(selector, checked, popts) //nolint:wrapcheck
			}), nil
		},
		"setContent": func(html string, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameSetContentOptions(rt, opts, f.Page().NavigationTimeout())
			if err != nil {
				return nil, fmt.Errorf("parsing setContent options: %w", err)
			}
			return promise(vu, func() (any, error) {
				return nil, f.SetContent(html, popts) //nolint:wrapcheck
			}), nil
		},
		"setInputFiles": func(selector string, files sobek.Value, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFrameSetInputFilesOptions(rt, opts, f.Timeout())
			if err != nil {

View on GitHub (pinned to 8d06114777)