{"record":{"id":"f27d814074e4707d","repo":"grafana/k6","slug":"missing-required-argument-placeholder-f27d81","errorCode":null,"errorMessage":"missing required argument 'placeholder'","messagePattern":"missing required argument 'placeholder'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/page_mapping.go","lineNumber":200,"sourceCode":"\t\t\t\treturn nil, errors.New(\"missing required argument 'altText'\")\n\t\t\t}\n\t\t\tpalt, popts := parseGetByBaseOptions(vu.Context(), alt, false, opts)\n\n\t\t\tml := mapLocator(vu, p.GetByAltText(palt, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"getByLabel\": func(label sobek.Value, opts sobek.Value) (*sobek.Object, error) {\n\t\t\tif k6common.IsNullish(label) {\n\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'\")","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/page_mapping.go#L182-L218","documentation":"Thrown by the Page mapping's getByPlaceholder method. The placeholder text is mandatory; the mapping rejects nullish values with k6common.IsNullish before parsing string/RegExp and options. This is the standard fail-fast guard for the getBy* locator family.","triggerScenarios":"page.getByPlaceholder() with no arguments; page.getByPlaceholder(undefined) from unset input data; passing options first: page.getByPlaceholder({ exact: true }).","commonSituations":"Login/search flows where the placeholder is sourced from localization files that may be incomplete; selector migrations from [placeholder=\"Search\"] to getByPlaceholder; typos in variable names leaving the argument undefined.","solutions":["Pass a string or RegExp: page.getByPlaceholder('Search...') or page.getByPlaceholder(/search/i)","Default-guard dynamic values: page.getByPlaceholder(ph ?? 'Search...')","Prefer locators over raw element queries so a single missing argument is caught at the call site"],"exampleFix":"// before\npage.getByPlaceholder();\n\n// after\npage.getByPlaceholder('Search...');","handlingStrategy":"validation","validationCode":"if (placeholder === undefined || placeholder === null) {\n  throw new Error(`page.getByPlaceholder: 'placeholder' is required, got ${placeholder}`);\n}\nconst loc = page.getByPlaceholder(placeholder, opts);","typeGuard":"function isTextMatcher(v) {\n  return typeof v === 'string' || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  page.getByPlaceholder(ph);\n} catch (e) {\n  if (!e.message.includes(\"missing required argument 'placeholder'\")) throw e;\n  throw new Error(`placeholder value missing`);\n}","preventionTips":["Localized string tables: assert every locale key exists before running browser steps"],"tags":["browser","page","getbyplaceholder","locator","argument-validation"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}