{"record":{"id":"b6085266ce0f47cc","repo":"grafana/k6","slug":"clearing-q-w","errorCode":null,"errorMessage":"clearing %q: %w","messagePattern":"clearing %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":75,"sourceCode":"}\n\n// BoundingBox will return the bounding box of the element.\nfunc (l *Locator) BoundingBox(opts *FrameBaseOptions) (*Rect, error) {\n\topts.Strict = true\n\treturn l.frame.boundingBox(l.selector, opts)\n}\n\n// Clear will clear the input field.\n// This works with the Fill API and fills the input field with an empty string.\nfunc (l *Locator) Clear(opts *FrameFillOptions) error {\n\tl.log.Debugf(\n\t\t\"Locator:Clear\", \"fid:%s furl:%q sel:%q opts:%+v\",\n\t\tl.frame.ID(), l.frame.URL(), l.selector, opts,\n\t)\n\n\topts.Strict = true\n\tif err := l.frame.fill(l.selector, \"\", opts); err != nil {\n\t\treturn fmt.Errorf(\"clearing %q: %w\", l.selector, err)\n\t}\n\n\treturn nil\n}\n\n// Timeout will return the default timeout or the one set by the user.\nfunc (l *Locator) Timeout() time.Duration {\n\treturn l.frame.defaultTimeout()\n}\n\n// Click on an element using locator's selector with strict mode on.\nfunc (l *Locator) Click(opts *FrameClickOptions) error {\n\tl.log.Debugf(\"Locator:Click\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\t_, span := TraceAPICall(l.ctx, l.frame.page.targetID.String(), \"locator.click\")\n\tdefer span.End()\n\n\topts.Strict = true\n\topts.retry = true","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/locator.go#L57-L93","documentation":"Returned by Locator.Clear when clearing the input field via Frame.fill with an empty string fails; strict mode is on, so it fires when the selector does not match exactly one element or the element is not fillable within the timeout. The input at fault is the locator's selector.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:75 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the selector matches exactly one element (strict mode rejects zero or multiple matches)","Increase the action timeout so the element can settle before filling","Use a more specific selector or wait for the element to be visible and enabled before clearing"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}