{"record":{"id":"46f2af734f6b46c0","repo":"grafana/k6","slug":"missing-required-argument-placeholder-46f2af","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_mapping.go","lineNumber":158,"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, f.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, f.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, f.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, f.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":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/frame_mapping.go#L140-L176","documentation":"Frame.getByPlaceholder(placeholder) on a k6 browser Frame requires a non-nullish first argument; the mapping layer throws before any browser interaction. The placeholder text (string or RegExp) is the sole criterion for locating inputs by placeholder attribute. Playwright's equivalent method is equally strict.","triggerScenarios":"Calling frame.getByPlaceholder() with no argument, passing null/undefined, or forwarding an undefined i18n/data value intended as the placeholder string.","commonSituations":"Locale-dependent placeholder strings, CSV-driven form tests with empty cells, or partially copied selectors from recorded sessions.","solutions":["Pass the placeholder string or RegExp: frame.getByPlaceholder('Enter search term')","Validate/default locale- or data-sourced placeholder values before the call","Fix the missing key or typo feeding the argument","Use a RegExp to cover language variants, e.g. getByPlaceholder(/search/i)"],"exampleFix":"// before\nconst q = page.frame('#app').getByPlaceholder(t('search.hint')); // t() returned undefined\n\n// after\nconst hint = t('search.hint') ?? 'Search';\nconst q = page.frame('#app').getByPlaceholder(hint);","handlingStrategy":"validation","validationCode":"const ph = i18n[field.name]?.placeholder;\nif (!isTextSelector(ph)) throw new Error(`placeholder missing for ${field.name} (${locale})`);\nframe.getByPlaceholder(ph);","typeGuard":"function isTextSelector(v) {\n  return (typeof v === 'string' && v.length > 0) || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  loc = frame.getByPlaceholder(maybePh);\n} catch (e) {\n  if (/missing required argument 'placeholder'/.test(String(e.message))) {\n    throw new Error(`placeholder missing for locale ${locale}`);\n  }\n  throw e;\n}","preventionTips":["Run a locale-completeness check for placeholder keys before load tests","Use RegExp placeholders to absorb small wording differences between locales","Avoid optional-chained lookups feeding getBy* without a fallback","Keep form field maps and locale bundles in the same review scope so they stay in sync"],"tags":["browser","frame","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"}