grafana/k6 · error
clearing
Error message
clearing %q: %w
What it means
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.
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
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/locator.go:75 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/b6085266ce0f47cc.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/locator.go:75
}
// BoundingBox will return the bounding box of the element.
func (l *Locator) BoundingBox(opts *FrameBaseOptions) (*Rect, error) {
opts.Strict = true
return l.frame.boundingBox(l.selector, opts)
}
// Clear will clear the input field.
// This works with the Fill API and fills the input field with an empty string.
func (l *Locator) Clear(opts *FrameFillOptions) error {
l.log.Debugf(
"Locator:Clear", "fid:%s furl:%q sel:%q opts:%+v",
l.frame.ID(), l.frame.URL(), l.selector, opts,
)
opts.Strict = true
if err := l.frame.fill(l.selector, "", opts); err != nil {
return fmt.Errorf("clearing %q: %w", l.selector, err)
}
return nil
}
// Timeout will return the default timeout or the one set by the user.
func (l *Locator) Timeout() time.Duration {
return l.frame.defaultTimeout()
}
// Click on an element using locator's selector with strict mode on.
func (l *Locator) Click(opts *FrameClickOptions) error {
l.log.Debugf("Locator:Click", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts)
_, span := TraceAPICall(l.ctx, l.frame.page.targetID.String(), "locator.click")
defer span.End()
opts.Strict = true
opts.retry = trueView on GitHub (pinned to 01ffac6f24)