grafana/k6 · error

parsing press options of selector

Error message

parsing press options of selector %q: %w

What it means

Generic parse wrapper for page.press: the options argument failed to decode into common.FramePressOptions; %q is the selector. The wrapped error names the offending option — typically delay/timeout/noWaitAfter with wrong types.

Solutions

  1. Ensure the key is a valid key name (e.g. 'Enter') and options only contain delay, timeout, noWaitAfter with correct types
  2. Check the wrapped error for the failing field
  3. Omit options to use defaults
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:365 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at internal/js/modules/k6/browser/browser/page_mapping.go:366

		"frameLocator": func(selector string) *sobek.Object {
			mfl := mapFrameLocator(vu, p.FrameLocator(selector))
			return rt.ToValue(mfl).ToObject(rt)
		},
		"mainFrame": func() *sobek.Object {
			mf := mapFrame(vu, p.MainFrame())
			return rt.ToValue(mf).ToObject(rt)
		},
		"mouse": mapMouse(vu, p.GetMouse()),
		"on":    mapPageOn(vu, p),
		"opener": func() *sobek.Promise {
			return promise(vu, func() (any, error) {
				return p.Opener(), nil
			})
		},
		"press": func(selector string, key string, opts sobek.Value) (*sobek.Promise, error) {
			popts, err := parseFramePressOptions(rt, opts, p.Timeout())
			if err != nil {
				return nil, fmt.Errorf("parsing press options of selector %q: %w", selector, err)
			}
			return promise(vu, func() (any, error) {
				return nil, p.Press(selector, key, popts) //nolint:wrapcheck
			}), nil
		},
		"reload": func(opts sobek.Value) (*sobek.Promise, error) {
			popts := common.NewPageReloadOptions(common.LifecycleEventLoad, p.NavigationTimeout())
			if err := popts.Parse(vu.Context(), opts); err != nil {
				return nil, fmt.Errorf("parsing reload options: %w", err)
			}
			return promise(vu, func() (any, error) {
				resp, err := p.Reload(popts)
				if err != nil {
					return nil, err //nolint:wrapcheck
				}
				if resp == nil {
					return nil, nil //nolint:nilnil
				}

View on GitHub (pinned to 8d06114777)