grafana/k6 · error

unchecking

Error message

unchecking %q: %w

What it means

Wrapped failure from Frame.uncheck while unchecking the element(s) matched by the locator's selector with strict mode forced on. Fires when the selector matches zero or multiple elements (strict violation), the element is not a checkbox/radio or is disabled, the action times out, or the underlying CDP call fails.

Solutions

  1. Use a selector that resolves to exactly one checkbox/radio element, or narrow it with .first()/.nth()/filter()
  2. Ensure the element is rendered and enabled before unchecking (page.waitForSelector or locator.WaitFor)
  3. Increase the per-action or browser-level timeout if the element animates in slowly
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/locator.go:197 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/0c0310aabd948b70. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/locator.go:197

	opts.Strict = true
	opts.retry = true
	if err := l.frame.check(l.selector, opts); err != nil {
		return fmt.Errorf("checking %q: %w", l.selector, err)
	}

	applySlowMo(l.ctx)

	return nil
}

// Uncheck on an element using locator's selector with strict mode on.
func (l *Locator) Uncheck(opts *FrameUncheckOptions) error {
	l.log.Debugf("Locator:Uncheck", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts)

	opts.Strict = true
	opts.retry = true
	if err := l.frame.uncheck(l.selector, opts); err != nil {
		return fmt.Errorf("unchecking %q: %w", l.selector, err)
	}

	applySlowMo(l.ctx)

	return nil
}

// IsChecked returns true if the element matches the locator's
// selector and is checked. Otherwise, returns false.
func (l *Locator) IsChecked(opts *FrameIsCheckedOptions) (bool, error) {
	l.log.Debugf("Locator:IsChecked", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts)

	opts.Strict = true
	checked, err := l.frame.isChecked(l.selector, opts)
	if err != nil {
		return false, fmt.Errorf("checking is %q checked: %w", l.selector, err)
	}

View on GitHub (pinned to 01ffac6f24)