{"record":{"id":"4e57ea0e086007ec","repo":"grafana/k6","slug":"missing-required-argument-title-4e57ea","errorCode":null,"errorMessage":"missing required argument 'title'","messagePattern":"missing required argument 'title'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/locator_mapping.go","lineNumber":290,"sourceCode":"\t\t\t\treturn nil, errors.New(\"missing required argument 'testId'\")\n\t\t\t}\n\t\t\tptestID := parseStringOrRegex(testID, false)\n\n\t\t\tml := mapLocator(vu, lo.GetByTestID(ptestID))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"getByText\": func(text sobek.Value, opts sobek.Value) (*sobek.Object, error) {\n\t\t\tif k6common.IsNullish(text) {\n\t\t\t\treturn nil, errors.New(\"missing required argument 'text'\")\n\t\t\t}\n\t\t\tptext, popts := parseGetByBaseOptions(vu.Context(), text, true, opts)\n\n\t\t\tml := mapLocator(vu, lo.GetByText(ptext, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"getByTitle\": func(title sobek.Value, opts sobek.Value) (*sobek.Object, error) {\n\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 := common.NewFrameInnerHTMLOptions(lo.Timeout())\n\t\t\tif err := copts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing inner HTML options: %w\", err)\n\t\t\t}","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/locator_mapping.go#L272-L308","documentation":"Thrown by the Frame mapping's getByTitle method in k6's browser module. The title argument is mandatory; the Go mapping checks it with k6common.IsNullish before calling lo.GetByTitle. Passing null/undefined (or omitting the argument) produces this error instead of a confusing low-level failure later.","triggerScenarios":"frame.getByTitle() with no arguments; frame.getByTitle(null); passing a variable that is undefined because a lookup (e.g. data.title) returned nothing.","commonSituations":"Dynamic titles sourced from config/data that can be missing; renaming calls from locator('[title=\"...\"]') to getByTitle and dropping the argument; partial application or callback wiring that passes undefined.","solutions":["Pass a string or RegExp title: frame.getByTitle('Close') or frame.getByTitle(/close/i)","Default-guard data-driven values: frame.getByTitle(title ?? 'Close')","Linter rule or code review for getBy* calls with zero arguments"],"exampleFix":"// before\nframe.getByTitle();\n\n// after\nframe.getByTitle('Close');","handlingStrategy":"validation","validationCode":"if (title === undefined || title === null) {\n  throw new Error(`frame.getByTitle: 'title' is required, got ${title}`);\n}\nconst loc = frame.getByTitle(title);","typeGuard":"function isTextMatcher(v) {\n  return typeof v === 'string' || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  frame.getByTitle(title);\n} catch (e) {\n  if (!e.message.includes(\"missing required argument 'title'\")) throw e;\n  throw new Error(`missing title in fixture/data`);\n}","preventionTips":["Default optional fixture fields: const title = fixture.title ?? 'Close'","Validate parsed config objects once at script start instead of at each call site"],"tags":["browser","frame","getbytitle","locator","argument-validation"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}