{"record":{"id":"f46ea19d8cb5dcf5","repo":"grafana/k6","slug":"double-clicking-on-x-f-y-f-w","errorCode":null,"errorMessage":"double clicking on x:%f y:%f: %w","messagePattern":"double clicking on x:(.+?) y:(.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/mouse.go","lineNumber":72,"sourceCode":"\t\t\tt := time.NewTimer(time.Duration(opts.Delay) * time.Millisecond)\n\t\t\tselect {\n\t\t\tcase <-m.ctx.Done():\n\t\t\t\tt.Stop()\n\t\t\tcase <-t.C:\n\t\t\t}\n\t\t}\n\t\tif err := m.up(mouseDownUpOpts); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// DblClick will trigger Click twice in quick succession.\nfunc (m *Mouse) DblClick(x float64, y float64, opts *MouseDblClickOptions) error {\n\tif err := m.click(x, y, opts.ToMouseClickOptions()); err != nil {\n\t\treturn fmt.Errorf(\"double clicking on x:%f y:%f: %w\", x, y, err)\n\t}\n\treturn nil\n}\n\n// Down will trigger a MouseDown event in the browser.\nfunc (m *Mouse) Down(opts *MouseDownUpOptions) error {\n\tif err := m.down(opts); err != nil {\n\t\treturn fmt.Errorf(\"pressing the mouse button on x:%f y:%f: %w\", m.x, m.y, err)\n\t}\n\treturn nil\n}\n\nfunc (m *Mouse) down(opts *MouseDownUpOptions) error {\n\tm.button = input.MouseButton(opts.Button)\n\taction := input.DispatchMouseEvent(input.MousePressed, m.x, m.y).\n\t\tWithButton(input.MouseButton(opts.Button)).\n\t\tWithModifiers(input.Modifier(m.keyboard.modifiers)).\n\t\tWithClickCount(opts.ClickCount)","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/mouse.go#L54-L90","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst box = await page.locator('tr.row').boundingBox();\nawait page.mouse.dblclick(box.x, box.y);\n\n// after\nconst row = page.locator('tr.row');\nawait row.waitFor();\nawait row.dblclick(); // selector-based, auto-resolves and retries","handlingStrategy":"try-catch","validationCode":"if (page.isClosed()) throw new Error('page closed');\nconst box = await page.locator('tr.row').boundingBox();\nif (!box) throw new Error('row not measurable');\nawait page.mouse.dblclick(box.x + box.width / 2, box.y + box.height / 2);","typeGuard":null,"tryCatchPattern":"try {\n  await page.mouse.dblclick(x, y);\n} catch (e) {\n  if (/target closed|session/i.test(e.message)) { /* recreate page, restart */ }\n  else throw e;\n}","preventionTips":["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"],"tags":["browser","mouse","cdp","dblclick"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}