grafana/k6 · error

tapping on

Error message

tapping on %q: %w

What it means

Wrapped failure from Frame.tap (with retry enabled) while tapping the element matched by the locator's selector (strict mode forced). Fires on zero/multiple matches, when the element is not tappable (hidden, zero-size, or covered by another element), or when the CDP touch events fail after retries.

Solutions

  1. Ensure the element is visible, has a stable bounding box, and is not covered
  2. Ensure touch emulation is active for the browser context when tapping
  3. Retry after waiting for overlays/spinners to disappear
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/locator.go:620 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/e65e1a8447f5ad2a. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/locator.go:620

	opts.Strict = true
	opts.retry = true
	if err := l.frame.hover(l.selector, opts); err != nil {
		return fmt.Errorf("hovering on %q: %w", l.selector, err)
	}

	applySlowMo(l.ctx)

	return nil
}

// Tap the element found that matches the locator's selector with strict mode on.
func (l *Locator) Tap(opts *FrameTapOptions) error {
	l.log.Debugf("Locator:Tap", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts)

	opts.Strict = true
	opts.retry = true
	if err := l.frame.tap(l.selector, opts); err != nil {
		return fmt.Errorf("tapping on %q: %w", l.selector, err)
	}

	applySlowMo(l.ctx)

	return nil
}

// DispatchEvent dispatches an event for the element matching the
// locator's selector with strict mode on.
func (l *Locator) DispatchEvent(typ string, eventInit any, opts *FrameDispatchEventOptions) error {
	l.log.Debugf(
		"Locator:DispatchEvent", "fid:%s furl:%q sel:%q typ:%q eventInit:%+v opts:%+v",
		l.frame.ID(), l.frame.URL(), l.selector, typ, eventInit, opts,
	)

	opts.Strict = true
	if err := l.frame.dispatchEvent(l.selector, typ, eventInit, opts); err != nil {
		return fmt.Errorf("dispatching locator event %q to %q: %w", typ, l.selector, err)

View on GitHub (pinned to 01ffac6f24)