{"record":{"id":"f90c43eb4ea511df","repo":"grafana/k6","slug":"mouse-down-w","errorCode":null,"errorMessage":"mouse down: %w","messagePattern":"mouse down: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/mouse.go","lineNumber":92,"sourceCode":"\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 {\n\tif err := m.up(opts); err != nil {\n\t\treturn fmt.Errorf(\"releasing the mouse button on x:%f y:%f: %w\", m.x, m.y, err)\n\t}\n\treturn nil\n}\n\nfunc (m *Mouse) up(opts *MouseDownUpOptions) error {\n\tm.button = input.None\n\taction := input.DispatchMouseEvent(input.MouseReleased, 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":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/mouse.go#L74-L110","documentation":"Low-level failure of the CDP Input.dispatchMouseEvent(MousePressed) command itself, carrying the button, modifiers, and click count. Fires when the DevTools protocol executor rejects the event — session closed, target gone, or browser-side input error — not because of element state.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/mouse.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the CDP session and target are alive before dispatching","Check the button value is a valid input.MouseButton constant","Avoid dispatching input events after page/target close"],"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"}