{"record":{"id":"a48ae03770a70952","repo":"grafana/k6","slug":"pressing-the-mouse-button-on-x-f-y-f-w","errorCode":null,"errorMessage":"pressing the mouse button on x:%f y:%f: %w","messagePattern":"pressing the mouse button on x:(.+?) y:(.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/mouse.go","lineNumber":80,"sourceCode":"\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)\n\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\treturn fmt.Errorf(\"mouse down: %w\", err)\n\t}\n\treturn nil\n}\n\n// Up will trigger a MouseUp event in the browser.\nfunc (m *Mouse) Up(opts *MouseDownUpOptions) error {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/mouse.go#L62-L98","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/mouse.go:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}