grafana/k6 · error
double clicking on x:%f y:%f: %w
Error message
double clicking on x:%f y:%f: %w
What it means
Thrown by Mouse.DblClick(x, y) when the underlying double-click sequence fails. It delegates to the same internal click() as Click, but performs the sequence twice in quick succession, making it more sensitive to state changes between clicks (navigation, overlay appearing, session close) and to CDP dispatch failures.
Source
Thrown at internal/js/modules/k6/browser/common/mouse.go:72
t := time.NewTimer(time.Duration(opts.Delay) * time.Millisecond)
select {
case <-m.ctx.Done():
t.Stop()
case <-t.C:
}
}
if err := m.up(mouseDownUpOpts); err != nil {
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)View on GitHub (pinned to 93accf6570)
Solutions
- Recompute coordinates from a fresh boundingBox() right before the call
- Ensure the target action does not navigate between the two clicks, or use elementHandle.dblclick() instead of raw mouse coordinates
- Verify the page is still open (page.isClosed()) before dispatching
- Wrap in try/catch and retry once after re-locating the element
Example fix
// before
const box = await page.locator('tr.row').boundingBox();
await page.mouse.dblclick(box.x, box.y);
// after
const row = page.locator('tr.row');
await row.waitFor();
await row.dblclick(); // selector-based, auto-resolves and retries Defensive patterns
Strategy: try-catch
Validate before calling
if (page.isClosed()) throw new Error('page closed');
const box = await page.locator('tr.row').boundingBox();
if (!box) throw new Error('row not measurable');
await page.mouse.dblclick(box.x + box.width / 2, box.y + box.height / 2); Try / catch
try {
await page.mouse.dblclick(x, y);
} catch (e) {
if (/target closed|session/i.test(e.message)) { /* recreate page, restart */ }
else throw e;
} Prevention
- Use locator.dblclick() for elements; reserve mouse.dblclick for coordinates
- Ensure double-click handlers do not navigate between clicks
- Keep the two clicks atomic — no awaits in between
When it happens
Trigger: mouse.dblclick(x, y) where the page navigates or the session drops between the two click cycles; an overlay appears after the first click and the second dispatch fails; browser crash during the sequence.
Common situations: Double-clicking rows in data grids that open a detail view (navigation between clicks); double-click triggering a modal that invalidates subsequent coordinates; reusing stale boundingBox coordinates.
Related errors
- clicking on x:%f y:%f: %w
- pressing the mouse button on x:%f y:%f: %w
- mouse down: %w
- releasing the mouse button on x:%f y:%f: %w
- mouse up: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/f46ea19d8cb5dcf5.
Report an issue: GitHub.