{"record":{"id":"d4d3cd5a319e1749","repo":"grafana/k6","slug":"filling-q-with-q-w","errorCode":null,"errorMessage":"filling %q with %q: %w","messagePattern":"filling %q with %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame.go","lineNumber":932,"sourceCode":"\t}\n\n\tf.waitForExecutionContext(mainWorld)\n\thandle, err := evalHandle()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"evaluating handle for frame: %w\", err)\n\t}\n\n\tapplySlowMo(f.ctx)\n\n\treturn handle, nil\n}\n\n// Fill fills out the first element found that matches the selector.\nfunc (f *Frame) Fill(selector, value string, popts *FrameFillOptions) error {\n\tf.log.Debugf(\"Frame:Fill\", \"fid:%s furl:%q sel:%q val:%q\", f.ID(), f.URL(), selector, value)\n\n\tif err := f.fill(selector, value, popts); err != nil {\n\t\treturn fmt.Errorf(\"filling %q with %q: %w\", selector, value, err)\n\t}\n\n\tapplySlowMo(f.ctx)\n\n\treturn nil\n}\n\nfunc (f *Frame) fill(selector, value string, opts *FrameFillOptions) error {\n\tfill := func(apiCtx context.Context, handle *ElementHandle) (any, error) {\n\t\treturn nil, handle.fill(apiCtx, value)\n\t}\n\tact := f.newAction(\n\t\tselector, DOMElementStateAttached, opts.Strict,\n\t\tfill, []string{\"visible\", \"enabled\", \"editable\"},\n\t\topts.Force, withRetry, opts.NoWaitAfter, opts.Timeout,\n\t)\n\tif _, err := call(f.ctx, act, opts.Timeout); err != nil {\n\t\treturn errorFromDOMError(err)","sourceCodeStart":914,"sourceCodeEnd":950,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/frame.go#L914-L950","documentation":"Frame.Fill() runs an action that waits for the element to be actionable and then sets its value directly (with an input event). This error wraps the underlying failures: 'element is not an <input>, <textarea> or [contenteditable]' from the injected script, 'element is not editable' (readonly/disabled), or a wait timeout.","triggerScenarios":"Filling a selector that points to a non-input element (div, span, custom widget); target is readonly/disabled; element hidden/covered so actionability checks time out; strict-mode multiple matches.","commonSituations":"Custom dropdowns/date pickers that are not real inputs (need click-based interaction); readonly form fields; select elements (fill does not apply — use selectOption); late-rendered inputs in SPAs.","solutions":["Confirm the target is input/textarea/contenteditable; for selects use frame.selectOption(), for custom widgets use click()/type().","Use a unique selector and waitForSelector visible before filling.","Remove readonly/disabled or pick a different field if the app blocks direct edits."],"exampleFix":"// before\nframe.fill('.date-display', '2026-08-15'); // div -> not an input\n\n// after\nframe.click('.date-display');\nframe.type('.date-display input', '2026-08-15');","handlingStrategy":"validation","validationCode":"await frame.waitForSelector(sel, { state: 'visible', timeout: 30000 });\nconst fillable = await frame.evaluate(\n  '(s) => { const el = document.querySelector(s); return !!el && (el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\" || el.isContentEditable) && !el.disabled && !el.readOnly; }',\n  sel\n);","typeGuard":null,"tryCatchPattern":"try {\n  frame.fill(sel, value, { timeout: 30000 });\n} catch (e) {\n  if (/not an <input>|not editable/.test(e.message)) { /* wrong element kind — use click/type or selectOption */ }\n}","preventionTips":["fill() only real inputs/textareas/contenteditable; use selectOption for selects and click-based flows for custom widgets.","Wait for visible and enabled state before filling.","Use unique selectors."],"tags":["browser","fill","input","actionability","timeout"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}