grafana/k6 · error
getting inner text of
Error message
getting inner text of %q: %w
What it means
Wrapped failure from Frame.innerText while retrieving the rendered inner text of the element matched by the locator's selector (strict mode forced). Fires on zero/multiple matches, element detachment or invisibility (innerText requires layout), or a failed CDP evaluation.
Solutions
- Narrow the selector to a single element
- Ensure the element is visible — innerText of hidden elements can fail or return empty
- Use TextContent instead when visibility-independent text is acceptable
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/locator.go:473 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/e9c396f5afaea9e1.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/locator.go:473
opts.Strict = true
s, err := l.frame.innerHTML(l.selector, opts)
if err != nil {
return "", fmt.Errorf("getting inner HTML of %q: %w", l.selector, err)
}
return s, nil
}
// InnerText returns the element's inner text that matches
// the locator's selector with strict mode on.
func (l *Locator) InnerText(opts *FrameInnerTextOptions) (string, error) {
l.log.Debugf("Locator:InnerText", "fid:%s furl:%q sel:%q opts:%+v", l.frame.ID(), l.frame.URL(), l.selector, opts)
opts.Strict = true
s, err := l.frame.innerText(l.selector, opts)
if err != nil {
return "", fmt.Errorf("getting inner text of %q: %w", l.selector, err)
}
return s, nil
}
// Last will return the last child of the element matching the locator's
// selector.
func (l *Locator) Last() *Locator {
return NewLocator(l.ctx, nil, l.selector+" >> nth=-1", l.frame, l.log)
}
// Nth will return the nth child of the element matching the locator's
// selector.
func (l *Locator) Nth(nth int) *Locator {
return NewLocator(l.ctx, nil, l.selector+" >> nth="+strconv.Itoa(nth), l.frame, l.log)
}
// TextContent returns the element's text content that matchesView on GitHub (pinned to 01ffac6f24)