{"record":{"id":"870dcf02b8df51ef","repo":"grafana/k6","slug":"moving-the-mouse-pointer-to-x-f-y-f-w","errorCode":null,"errorMessage":"moving the mouse pointer to x:%f y:%f: %w","messagePattern":"moving the mouse pointer to x:(.+?) y:(.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/mouse.go","lineNumber":121,"sourceCode":"}\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)\n\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\treturn fmt.Errorf(\"mouse up: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// Move will trigger a MouseMoved event in the browser.\nfunc (m *Mouse) Move(x float64, y float64, opts *MouseMoveOptions) error {\n\tif err := m.move(x, y, opts); err != nil {\n\t\treturn fmt.Errorf(\"moving the mouse pointer to x:%f y:%f: %w\", x, y, err)\n\t}\n\treturn nil\n}\n\nfunc (m *Mouse) move(x float64, y float64, opts *MouseMoveOptions) error {\n\tfromX := m.x\n\tfromY := m.y\n\tm.x = x\n\tm.y = y\n\tfor i := int64(1); i <= opts.Steps; i++ {\n\t\tx := fromX + (m.x-fromX)*float64(i/opts.Steps)\n\t\ty := fromY + (m.y-fromY)*float64(i/opts.Steps)\n\t\taction := input.DispatchMouseEvent(input.MouseMoved, x, y).\n\t\t\tWithButton(m.button).\n\t\t\tWithModifiers(input.Modifier(m.keyboard.modifiers))\n\t\tif err := action.Do(cdp.WithExecutor(m.ctx, m.session)); err != nil {\n\t\t\treturn fmt.Errorf(\"mouse move: %w\", err)\n\t\t}","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/mouse.go#L103-L139","documentation":"Wrapped failure from Mouse.move while moving the pointer to the new coordinates. Fires when any CDP Input.dispatchMouseEvent(MouseMoved) step in the interpolated path fails — closed session, canceled context, or invalid target — not because of page content at the destination.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/mouse.go:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the session is alive before moving","Keep target coordinates within the viewport bounds","Use fewer steps or smaller moves if the error occurs mid-sequence during teardown"],"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"}