{"record":{"id":"e9c396f5afaea9e1","repo":"grafana/k6","slug":"getting-inner-text-of-q-w-e9c396","errorCode":null,"errorMessage":"getting inner text of %q: %w","messagePattern":"getting inner text of %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":473,"sourceCode":"\n\topts.Strict = true\n\ts, err := l.frame.innerHTML(l.selector, opts)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getting inner HTML of %q: %w\", l.selector, err)\n\t}\n\n\treturn s, nil\n}\n\n// InnerText returns the element's inner text that matches\n// the locator's selector with strict mode on.\nfunc (l *Locator) InnerText(opts *FrameInnerTextOptions) (string, error) {\n\tl.log.Debugf(\"Locator:InnerText\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\n\topts.Strict = true\n\ts, err := l.frame.innerText(l.selector, opts)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getting inner text of %q: %w\", l.selector, err)\n\t}\n\n\treturn s, nil\n}\n\n// Last will return the last child of the element matching the locator's\n// selector.\nfunc (l *Locator) Last() *Locator {\n\treturn NewLocator(l.ctx, nil, l.selector+\" >> nth=-1\", l.frame, l.log)\n}\n\n// Nth will return the nth child of the element matching the locator's\n// selector.\nfunc (l *Locator) Nth(nth int) *Locator {\n\treturn NewLocator(l.ctx, nil, l.selector+\" >> nth=\"+strconv.Itoa(nth), l.frame, l.log)\n}\n\n// TextContent returns the element's text content that matches","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/locator.go#L455-L491","documentation":"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.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:473 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}