{"record":{"id":"31f8d523775c4d1d","repo":"grafana/k6","slug":"parsing-element-double-click-options-w","errorCode":null,"errorMessage":"parsing element double click options: %w","messagePattern":"parsing element double click options: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/element_handle_mapping.go","lineNumber":60,"sourceCode":"\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\terr := eh.Click(popts)\n\t\t\t\treturn nil, err //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"contentFrame\": func() *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\tf, err := eh.ContentFrame()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err //nolint:wrapcheck\n\t\t\t\t}\n\t\t\t\treturn mapFrame(vu, f), nil\n\t\t\t})\n\t\t},\n\t\t\"dblclick\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewElementHandleDblclickOptions(eh.DefaultTimeout())\n\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing element double click options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, eh.Dblclick(popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"dispatchEvent\": func(typ string, eventInit sobek.Value) *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, eh.DispatchEvent(typ, exportArg(eventInit)) //nolint:wrapcheck\n\t\t\t})\n\t\t},\n\t\t\"fill\": func(value string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewElementHandleBaseOptions(eh.DefaultTimeout())\n\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing element fill options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, eh.Fill(value, popts) //nolint:wrapcheck\n\t\t\t}), nil","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/element_handle_mapping.go#L42-L78","documentation":"Thrown synchronously by ElementHandle.dblclick() when its options fail to parse. ElementHandleDblclickOptions embeds base-pointer options plus button, delay and modifiers; in common/element_handle_options.go the failing steps are exporting 'position' to map[string]float64 and 'modifiers' to []string. As with the other mapping methods, the (nil, error) return becomes a synchronous JS exception, not a promise rejection.","triggerScenarios":"el.dblclick({ position: 'center' }), { position: { x: 10 } } with y missing is fine (missing keys become 0) but { position: '10,20' } or { position: 42 } fails the ExportTo; { modifiers: 'Control' } or { modifiers: [true] } fails the []string export.","commonSituations":"Reusing a hover/click options literal across actions where one call site stored position as a serialized string; passing DOMRect values without unpacking to {x, y}; ported Playwright tests that compute modifiers dynamically and occasionally produce a single string.","solutions":["Pass position as { x: <number>, y: <number> } and modifiers as a string array","Unpack boundingBox() results explicitly instead of passing the box or a string","Normalize modifiers once (Array.isArray check) in a shared helper used by all actions","Wrap in try/catch and match /parsing element double click options/ to distinguish option errors from runtime action errors"],"exampleFix":"// before\nawait el.dblclick({ modifiers: 'Ctrl', position: `${x},${y}` });\n\n// after\nawait el.dblclick({ modifiers: ['Control'], position: { x: x, y: y } });","handlingStrategy":"type-guard","validationCode":"if (opts?.position !== undefined &&\n    (typeof opts.position !== 'object' || Array.isArray(opts.position) ||\n     !Number.isFinite(Number(opts.position.x)) || !Number.isFinite(Number(opts.position.y)))) {\n  throw new Error('dblclick(): position must be { x: number, y: number }');\n}\nif (opts?.modifiers !== undefined &&\n    !(Array.isArray(opts.modifiers) && opts.modifiers.every(m => typeof m === 'string'))) {\n  throw new Error('dblclick(): modifiers must be an array of strings');\n}","typeGuard":"function isDblclickOpts(o) {\n  if (o == null) return true;\n  const posOk = o.position === undefined ||\n    (typeof o.position === 'object' && !Array.isArray(o.position) &&\n     Number.isFinite(Number(o.position.x)) && Number.isFinite(Number(o.position.y)));\n  const modOk = o.modifiers === undefined ||\n    (Array.isArray(o.modifiers) && o.modifiers.every(m => typeof m === 'string'));\n  return posOk && modOk;\n}","tryCatchPattern":"try {\n  await el.dblclick(opts);\n} catch (e) {\n  if (/parsing element double click options/.test(String(e.message))) {\n    console.log(`fix dblclick options: ${e.message}`);\n  } else throw e;\n}","preventionTips":["Unpack boundingBox() to { x, y } explicitly rather than passing derived strings or arrays","Normalize modifiers once for click/dblclick/hover/tap via a shared helper","The inner cause after the colon names the exact failing field; read it before changing code"],"tags":["k6","browser","element-handle","dblclick","option-parsing"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}