{"record":{"id":"261a8eb571bfdb2b","repo":"grafana/k6","slug":"missing-required-argument-title","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/frame_locator_mapping.go","lineNumber":71,"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, fl.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, fl.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, fl.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, fl.Locator(selector, parseLocatorOptions(rt, opts)))\n\t\t},\n\t\t\"frameLocator\": func(selector string) *sobek.Object {\n\t\t\tmfl := mapFrameLocator(vu, fl.FrameLocator(selector))\n\t\t\treturn rt.ToValue(mfl).ToObject(rt)\n\t\t},\n\t}\n}\n","sourceCodeStart":53,"sourceCodeEnd":87,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/frame_locator_mapping.go#L53-L87","documentation":"FrameLocator.getByTitle(title) in the k6 browser module requires a non-nullish first argument; the mapping layer rejects absent, null, or undefined values up front. The title (string or RegExp) matches elements' title attribute and is the method's only selector input. This mirrors Playwright's mandatory-argument contract.","triggerScenarios":"Calling page.frameLocator('iframe').getByTitle() with no argument, passing null/undefined, or forwarding a tooltip-text variable that resolved to undefined from test data.","commonSituations":"Tooltip/aria-title assertions where the expected string lives in external data, refactors renaming title variables, or helper functions with optional parameters passed through directly.","solutions":["Pass the title string or RegExp: frameLocator.getByTitle('Close dialog')","Validate or default the data-sourced title before the call","Fix the property name or export supplying the value","Use a RegExp for dynamic titles, e.g. getByTitle(/^Error \\(\\d+\\)$/)"],"exampleFix":"// before\nconst closeBtn = page.frameLocator('#modal-frame').getByTitle(tooltipVar); // tooltipVar is undefined\n\n// after\nconst tooltipVar = 'Close this dialog';\nconst closeBtn = page.frameLocator('#modal-frame').getByTitle(tooltipVar);","handlingStrategy":"validation","validationCode":"const title = tips.close;\nif (!isTextSelector(title)) throw new Error('tips.close is required for getByTitle');\nframeLocator.getByTitle(title);","typeGuard":"function isTextSelector(v) {\n  return (typeof v === 'string' && v.length > 0) || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  loc = frameLocator.getByTitle(maybeTitle);\n} catch (e) {\n  if (/missing required argument 'title'/.test(String(e.message))) {\n    throw new Error(`title missing; check tooltip data for key='${key}'`);\n  }\n  throw e;\n}","preventionTips":["Keep tooltip/title expectations beside other selectors in the page object and validate them together","Default optional tooltip strings at the data boundary with ??","Use RegExp for titles containing counters or dynamic segments","Smoke-test help/icon overlays once per UI change"],"tags":["browser","frame-locator","argument-validation","get-by"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}