grafana/k6 · error

getting attribute %q of %q: %w

Error message

getting attribute %q of %q: %w

What it means

Error "getting attribute %q of %q: %w" thrown in grafana/k6.

Source

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

	}

	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 {
		return "", false, fmt.Errorf("getting attribute %q of %q: %w", name, l.selector, err)
	}

	return s, ok, nil
}

// GetByAltText creates and returns a new relative locator that allows locating elements by their alt text.
func (l *Locator) GetByAltText(alt string, opts *GetByBaseOptions) *Locator {
	l.log.Debugf(
		"Locator:GetByAltText", "fid:%s furl:%q selector:%s alt:%q opts:%+v",
		l.frame.ID(), l.frame.URL(), l.selector, alt, opts,
	)

	return l.Locator(l.frame.buildAttributeSelector("alt", alt, opts), nil)
}

// GetByLabel creates and returns a new relative locator that allows locating input elements by the text
// of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.
func (l *Locator) GetByLabel(label string, opts *GetByBaseOptions) *Locator {

View on GitHub (pinned to 93accf6570)

When it happens

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