grafana/k6 · error
pressing the mouse button on x
Error message
pressing the mouse button on x:%f y:%f: %w
What it means
Wrapped failure from Mouse.down while pressing a mouse button at the current pointer position (m.x, m.y). Fires when the CDP Input.dispatchMouseEvent(MousePressed) command fails — typically a closed/detached session or a canceled context, since the press itself is unconditional.
Solutions
- Ensure the browser session is still active before pressing
- Call Mouse.Move first so the intended coordinates are current
- Wrap press/release pairs so a failure doesn't leave the button logically held
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/mouse.go:80 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/a48ae03770a70952.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/mouse.go:80
return err
}
}
return nil
}
// DblClick will trigger Click twice in quick succession.
func (m *Mouse) DblClick(x float64, y float64, opts *MouseDblClickOptions) error {
if err := m.click(x, y, opts.ToMouseClickOptions()); err != nil {
return fmt.Errorf("double clicking on x:%f y:%f: %w", x, y, err)
}
return nil
}
// Down will trigger a MouseDown event in the browser.
func (m *Mouse) Down(opts *MouseDownUpOptions) error {
if err := m.down(opts); err != nil {
return fmt.Errorf("pressing the mouse button on x:%f y:%f: %w", m.x, m.y, err)
}
return nil
}
func (m *Mouse) down(opts *MouseDownUpOptions) error {
m.button = input.MouseButton(opts.Button)
action := input.DispatchMouseEvent(input.MousePressed, m.x, m.y).
WithButton(input.MouseButton(opts.Button)).
WithModifiers(input.Modifier(m.keyboard.modifiers)).
WithClickCount(opts.ClickCount)
if err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {
return fmt.Errorf("mouse down: %w", err)
}
return nil
}
// Up will trigger a MouseUp event in the browser.
func (m *Mouse) Up(opts *MouseDownUpOptions) error {View on GitHub (pinned to 01ffac6f24)