{"record":{"id":"c492e40553cfcc4b","repo":"grafana/k6","slug":"missing-required-argument-title-c492e4","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/page_mapping.go","lineNumber":209,"sourceCode":"\t\t\t\treturn nil, errors.New(\"missing required argument 'label'\")\n\t\t\t}\n\t\t\tplabel, popts := parseGetByBaseOptions(vu.Context(), label, true, opts)\n\n\t\t\tml := mapLocator(vu, p.GetByLabel(plabel, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"getByPlaceholder\": func(placeholder sobek.Value, opts sobek.Value) (*sobek.Object, error) {\n\t\t\tif k6common.IsNullish(placeholder) {\n\t\t\t\treturn nil, errors.New(\"missing required argument 'placeholder'\")\n\t\t\t}\n\t\t\tpplaceholder, popts := parseGetByBaseOptions(vu.Context(), placeholder, false, opts)\n\n\t\t\tml := mapLocator(vu, p.GetByPlaceholder(pplaceholder, 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, p.GetByTitle(ptitle, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"getByTestId\": func(testID sobek.Value) (*sobek.Object, error) {\n\t\t\tif k6common.IsNullish(testID) {\n\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, p.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'\")","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/page_mapping.go#L191-L227","documentation":"Thrown by the Page mapping's getByTitle method (the Page-level twin of Frame.getByTitle). The title argument is mandatory and validated with k6common.IsNullish before p.GetByTitle is called with parsed base options. Nullish first arguments never reach locator construction.","triggerScenarios":"page.getByTitle() with no arguments; page.getByTitle(null); a title variable that is undefined after data-driven refactors.","commonSituations":"Tooltip/link testing where titles come from fixtures; moving between frame.getByTitle and page.getByTitle and losing the argument; passing an options object in the first position.","solutions":["Pass a string or RegExp: page.getByTitle('More info') or page.getByTitle(/info/i)","Guard dynamic titles: page.getByTitle(title ?? 'More info')","Keep a lint/review check that every getBy* call has a non-empty first argument"],"exampleFix":"// before\npage.getByTitle();\n\n// after\npage.getByTitle('More info');","handlingStrategy":"validation","validationCode":"if (title === undefined || title === null) {\n  throw new Error(`page.getByTitle: 'title' is required, got ${title}`);\n}\nconst loc = page.getByTitle(title, opts);","typeGuard":"function isTextMatcher(v) {\n  return typeof v === 'string' || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  page.getByTitle(title);\n} catch (e) {\n  if (!e.message.includes(\"missing required argument 'title'\")) throw e;\n  throw new Error(`title attribute value missing`);\n}","preventionTips":["Same guard as other getBy* methods — centralize in one locator helper"],"tags":["browser","page","getbytitle","locator","argument-validation"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}