{"record":{"id":"7063050901ff3795","repo":"grafana/k6","slug":"missing-required-argument-placeholder-706305","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/locator_mapping.go","lineNumber":254,"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, lo.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, lo.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, lo.GetByPlaceholder(pplaceholder, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"getByRole\": func(role sobek.Value, opts sobek.Value) (*sobek.Object, error) {\n\t\t\tif k6common.IsNullish(role) {\n\t\t\t\treturn nil, errors.New(\"missing required argument 'role'\")\n\t\t\t}\n\t\t\tpopts := parseGetByRoleOptions(vu.Context(), opts)\n\n\t\t\tml := mapLocator(vu, lo.GetByRole(role.String(), 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":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/locator_mapping.go#L236-L272","documentation":"Locator.getByPlaceholder(placeholder) in the k6 browser module requires a non-nullish first argument; the mapping throws before any browser call. The placeholder (string or RegExp) is the locator's only input for finding inputs by placeholder attribute within the locator scope. Playwright enforces the same contract.","triggerScenarios":"Calling page.locator('.search-bar').getByPlaceholder() with no argument, passing null/undefined, or forwarding an undefined placeholder from locale data or a selectors module.","commonSituations":"Localized search widgets, sparse CSV-driven test data, or constants renamed after a page-object refactor.","solutions":["Pass the placeholder string or RegExp: page.locator('.search').getByPlaceholder('Search docs')","Validate/default locale-sourced placeholder values before the call","Fix the undefined constant, key, or import","Use a RegExp across locales, e.g. getByPlaceholder(/suchen|search/i)"],"exampleFix":"// before\nconst input = page.locator('.search-bar').getByPlaceholder(i18n.searchHint); // undefined\n\n// after\nconst hint = i18n.searchHint ?? 'Search';\nconst input = page.locator('.search-bar').getByPlaceholder(hint);","handlingStrategy":"validation","validationCode":"const ph = localeData.searchHint;\nif (!isTextSelector(ph)) throw new Error(`searchHint missing for locale ${locale}`);\nlocator.getByPlaceholder(ph);","typeGuard":"function isTextSelector(v) {\n  return (typeof v === 'string' && v.length > 0) || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  sub = locator.getByPlaceholder(maybePh);\n} catch (e) {\n  if (/missing required argument 'placeholder'/.test(String(e.message))) {\n    throw new Error(`placeholder missing; locale=${locale}`);\n  }\n  throw e;\n}","preventionTips":["Add locale-bundle completeness checks for selector-visible strings","Default locale lookups with ?? before passing into chained locators","Prefer RegExp placeholders across near-identical locales","Keep widget page objects and their locale keys in one review unit"],"tags":["browser","locator","argument-validation","get-by","forms"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}