{"record":{"id":"5e205057e76f4629","repo":"grafana/k6","slug":"missing-required-argument-placeholder","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/frame_locator_mapping.go","lineNumber":35,"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, fl.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, fl.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, fl.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, fl.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":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/frame_locator_mapping.go#L17-L53","documentation":"FrameLocator.getByPlaceholder(placeholder) in the k6 browser module requires a non-nullish first argument; the mapping layer rejects absent, null, or undefined values before any browser call. The placeholder text (string or RegExp) is the sole selector input for finding inputs by placeholder attribute. Playwright's API has the same mandatory-argument contract.","triggerScenarios":"Calling page.frameLocator('iframe').getByPlaceholder(), passing null/undefined explicitly, or forwarding a placeholder variable that was never assigned (typo, missing i18n key, empty test-data column).","commonSituations":"Localized test suites where the placeholder string lookup fails for one locale, CSV/JSON-driven scripts with missing placeholder columns, or partially ported Playwright helpers.","solutions":["Pass the placeholder string or RegExp: frameLocator.getByPlaceholder('Search products')","Validate or default the value sourced from data or i18n bundles before the call","Fix the undefined variable or missing key feeding the argument","Use a RegExp for language-variant placeholders, e.g. getByPlaceholder(/^Search/)"],"exampleFix":"// before\nconst search = page.frameLocator('#widget').getByPlaceholder(placeholderKey); // placeholderKey is undefined\n\n// after\nconst placeholderKey = 'Search';\nconst search = page.frameLocator('#widget').getByPlaceholder(placeholderKey);","handlingStrategy":"validation","validationCode":"const ph = t('search.placeholder');\nif (!isTextSelector(ph)) throw new Error('search.placeholder missing from i18n bundle');\nframeLocator.getByPlaceholder(ph);","typeGuard":"function isTextSelector(v) {\n  return (typeof v === 'string' && v.length > 0) || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  loc = frameLocator.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 a startup check that every i18n key used by selectors resolves to a non-empty string","Cover all locales in a cheap pre-flight test before running load tests","Keep placeholder strings in one locale file per language and lint for missing keys","Use RegExp selectors to tolerate minor locale variation instead of dropping the argument"],"tags":["browser","frame-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"}