grafana/k6 · error

focusing on %q: %w

Error message

focusing on %q: %w

What it means

Error "focusing on %q: %w" thrown in grafana/k6.

Source

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

// Filter returns a new [Locator] after applying the options to the current one.
func (l *Locator) Filter(opts *LocatorFilterOptions) *Locator {
	return NewLocator(l.ctx, opts.LocatorOptions, l.selector, l.frame, l.log)
}

// First will return the first child of the element matching the locator's
// selector.
func (l *Locator) First() *Locator {
	return NewLocator(l.ctx, nil, l.selector+" >> nth=0", l.frame, l.log)
}

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

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

	applySlowMo(l.ctx)

	return nil
}

// GetAttribute of the element using locator's selector with strict mode on.
// The second return value is true if the attribute exists, and false otherwise.
func (l *Locator) GetAttribute(name string, opts *FrameBaseOptions) (string, bool, error) {
	l.log.Debugf(
		"Locator:GetAttribute", "fid:%s furl:%q sel:%q name:%q opts:%+v",
		l.frame.ID(), l.frame.URL(), l.selector, name, opts,
	)

	opts.Strict = true
	s, ok, err := l.frame.getAttribute(l.selector, name, opts)
	if err != nil {

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/locator.go:342 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/811c5a9b6acde7f0. Report an issue: GitHub.