{"record":{"id":"3343d3446a4145a3","repo":"grafana/k6","slug":"parsing-inner-html-options-w-3343d3","errorCode":null,"errorMessage":"parsing inner HTML options: %w","messagePattern":"parsing inner HTML options: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":308,"sourceCode":"\t\t\tif k6common.IsNullish(title) {\n\t\t\t\treturn nil, errors.New(\"missing required argument 'title'\")\n\t\t\t}\n\t\t\tptitle, popts := parseGetByBaseOptions(vu.Context(), title, false, opts)\n\n\t\t\tml := mapLocator(vu, lo.GetByTitle(ptitle, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"locator\": func(selector string, opts sobek.Value) mapping {\n\t\t\treturn mapLocator(vu, lo.Locator(selector, parseLocatorOptions(rt, opts)))\n\t\t},\n\t\t\"frameLocator\": func(selector string) *sobek.Object {\n\t\t\tmfl := mapFrameLocator(vu, lo.FrameLocator(selector))\n\t\t\treturn rt.ToValue(mfl).ToObject(rt)\n\t\t},\n\t\t\"innerHTML\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameInnerHTMLOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing inner HTML options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.InnerHTML(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"innerText\": func(opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tcopts, err := parseFrameInnerTextOptions(rt, opts, lo.Timeout())\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing inner text options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn lo.InnerText(copts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"last\": func() *sobek.Object {\n\t\t\tml := mapLocator(vu, lo.Last())\n\t\t\treturn rt.ToValue(ml).ToObject(rt)\n\t\t},","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/locator_mapping.go#L290-L326","documentation":"Thrown synchronously when the options argument to locator.innerHTML() fails to parse. The mapping (locator_mapping.go:305-309) creates common.FrameInnerHTMLOptions (FrameBaseOptions seeded with the locator timeout) and wraps Parse failures as \"parsing inner HTML options: %w\". FrameBaseOptions.Parse reads only strict and timeout via coercing accessors and returns nil for ordinary values, so the wrapped error indicates sobek raised while accessing properties of the options object — a throwing getter, Proxy trap, or throwing coercion.","triggerScenarios":"A throwing getter on timeout/strict; Proxy-wrapped options with raising get/ownKeys traps; a timeout whose implicit conversion to number throws.","commonSituations":"Snapshot helpers that lazily compute timeouts in getters; Proxied arguments from tracing tools; class-based options objects with accessors.","solutions":["Call locator.innerHTML() with no options or a plain { timeout: ms } literal","Compute values first; keep options as plain data","Unwrap Proxies before passing to browser APIs","try/catch around the call for controlled failure reporting"],"exampleFix":"// before\nawait locator.innerHTML({ get timeout() { return this.t; } }); // undefined this in getter throws\n\n// after\nawait locator.innerHTML({ timeout: 3000 });","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isPlainBaseOptions(o) {\n  return o == null || (typeof o === 'object' &&\n    (o.timeout === undefined || typeof o.timeout === 'number') &&\n    (o.strict === undefined || typeof o.strict === 'boolean'));\n}","tryCatchPattern":"try {\n  const html = await locator.innerHTML(opts);\n} catch (e) {\n  throw new Error(`innerHTML failed (options must be plain { timeout, strict }): ${e}`);\n}","preventionTips":["Use plain literals for snapshot options","Compute timeouts before the call","No accessors on option objects"],"tags":["k6","browser","locator","innerhtml","options"],"backgroundTag":"invalid-options-object","analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-09-14T20:10:14.619Z","contentChangedAt":"2026-09-14T20:10:14.619Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}