{"record":{"id":"4cc3c3571046d305","repo":"grafana/k6","slug":"missing-required-argument-title-4cc3c3","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_mapping.go","lineNumber":194,"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, f.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, f.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, f.GetByTitle(ptitle, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"goto\": func(url string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tgopts := common.NewFrameGotoOptions(\n\t\t\t\tf.Referrer(),\n\t\t\t\tf.NavigationTimeout(),\n\t\t\t)\n\t\t\tif err := gopts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing frame navigation options to %q: %w\", url, err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\tresp, err := f.Goto(url, gopts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err //nolint:wrapcheck","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/frame_mapping.go#L176-L212","documentation":"Frame.getByTitle(title) on a k6 browser Frame 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, mirroring Playwright.","triggerScenarios":"Calling frame.getByTitle() with no argument, passing null/undefined, or forwarding a tooltip string variable that resolved to undefined from external data.","commonSituations":"Tooltip/accessibility-title assertions with data-sourced expectations, refactors renaming title variables, helpers with optional title parameters.","solutions":["Pass the title string or RegExp: frame.getByTitle('Dismiss')","Validate or default the data-sourced title before the call","Fix the property name or import supplying the value","Use a RegExp for dynamic titles, e.g. frame.getByTitle(/\\(\\d+\\)$/), rather than dropping the argument"],"exampleFix":"// before\nconst btn = page.frame('#frame').getByTitle(titleVar); // titleVar is undefined\n\n// after\nconst titleVar = 'Close notification';\nconst btn = page.frame('#frame').getByTitle(titleVar);","handlingStrategy":"validation","validationCode":"const title = tips[name];\nif (!isTextSelector(title)) throw new Error(`tips.${name} is required for getByTitle`);\nframe.getByTitle(title);","typeGuard":"function isTextSelector(v) {\n  return (typeof v === 'string' && v.length > 0) || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  loc = frame.getByTitle(maybeTitle);\n} catch (e) {\n  if (/missing required argument 'title'/.test(String(e.message))) {\n    throw new Error(`title missing for '${name}' in frame`);\n  }\n  throw e;\n}","preventionTips":["Store title/tooltip expectations with other page data and validate them in the same pass","Use ?? defaults at the data boundary for optional tooltip strings","Use RegExp titles when counters or dynamic segments are present","Re-verify accessibility titles after UI library upgrades"],"tags":["browser","frame","argument-validation","get-by"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}