grafana/k6 · error
tapping
Error message
tapping: %w
What it means
Returned by Touchscreen.Tap when the underlying tap() helper fails. tap() dispatches exactly two CDP Input.dispatchTouchEvent actions (touchStart then touchEnd) with the current keyboard modifiers, so this error wraps a failure of either CDP dispatch. It fires when the touch event cannot be delivered — most commonly a broken/closed CDP session or an invalidated page target, since dispatchTouchEvent itself does little validation of coordinates.
Solutions
- Verify the browser and page are still open before tapping
- Retry the tap after the page reaches an interactive state
- Check the wrapped error to see whether the touch start or touch end dispatch failed
- Ensure the browser was launched with a mobile/touch-capable emulation if events are rejected
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/touchscreen.go:30 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/f9e7718d1aad62b6.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/touchscreen.go:30
type Touchscreen struct {
ctx context.Context
session session
keyboard *Keyboard
}
// NewTouchscreen returns a new TouchScreen.
func NewTouchscreen(ctx context.Context, s session, k *Keyboard) *Touchscreen {
return &Touchscreen{
ctx: ctx,
session: s,
keyboard: k,
}
}
// Tap dispatches a tap start and tap end event.
func (t *Touchscreen) Tap(x float64, y float64) error {
if err := t.tap(x, y); err != nil {
return fmt.Errorf("tapping: %w", err)
}
return nil
}
func (t *Touchscreen) tap(x float64, y float64) error {
touchStart := input.DispatchTouchEvent(
input.TouchStart,
[]*input.TouchPoint{{X: x, Y: y}},
).WithModifiers(
input.Modifier(t.keyboard.modifiers),
)
if err := touchStart.Do(cdp.WithExecutor(t.ctx, t.session)); err != nil {
return fmt.Errorf("touch start: %w", err)
}
touchEnd := input.DispatchTouchEvent(
input.TouchEnd,
[]*input.TouchPoint{},View on GitHub (pinned to 01ffac6f24)