{"record":{"id":"ff262c0689a0068f","repo":"grafana/k6","slug":"getting-attribute-q-of-q-w-ff262c","errorCode":null,"errorMessage":"getting attribute %q of %q: %w","messagePattern":"getting attribute %q of %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":361,"sourceCode":"\t}\n\n\tapplySlowMo(l.ctx)\n\n\treturn nil\n}\n\n// GetAttribute of the element using locator's selector with strict mode on.\n// The second return value is true if the attribute exists, and false otherwise.\nfunc (l *Locator) GetAttribute(name string, opts *FrameBaseOptions) (string, bool, error) {\n\tl.log.Debugf(\n\t\t\"Locator:GetAttribute\", \"fid:%s furl:%q sel:%q name:%q opts:%+v\",\n\t\tl.frame.ID(), l.frame.URL(), l.selector, name, opts,\n\t)\n\n\topts.Strict = true\n\ts, ok, err := l.frame.getAttribute(l.selector, name, opts)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"getting attribute %q of %q: %w\", name, l.selector, err)\n\t}\n\n\treturn s, ok, nil\n}\n\n// GetByAltText creates and returns a new relative locator that allows locating elements by their alt text.\nfunc (l *Locator) GetByAltText(alt string, opts *GetByBaseOptions) *Locator {\n\tl.log.Debugf(\n\t\t\"Locator:GetByAltText\", \"fid:%s furl:%q selector:%s alt:%q opts:%+v\",\n\t\tl.frame.ID(), l.frame.URL(), l.selector, alt, opts,\n\t)\n\n\treturn l.Locator(l.frame.buildAttributeSelector(\"alt\", alt, opts), nil)\n}\n\n// GetByLabel creates and returns a new relative locator that allows locating input elements by the text\n// of the associated `<label>` or `aria-labelledby` element, or by the `aria-label` attribute.\nfunc (l *Locator) GetByLabel(label string, opts *GetByBaseOptions) *Locator {","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/locator.go#L343-L379","documentation":"Error \"getting attribute %q of %q: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:361 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}