{"record":{"id":"3dc2b9313d4c7744","repo":"grafana/k6","slug":"checking-is-q-visible-w-3dc2b9","errorCode":null,"errorMessage":"checking is %q visible: %w","messagePattern":"checking is %q visible: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":283,"sourceCode":"\tl.log.Debugf(\"Locator:IsInViewport\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\n\topts.Strict = true\n\tinViewport, err := l.frame.isInViewport(l.selector, opts)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"checking is %q in viewport: %w\", l.selector, err)\n\t}\n\n\treturn inViewport, nil\n}\n\n// IsVisible returns true if the element matches the locator's\n// selector and is visible. Otherwise, returns false.\nfunc (l *Locator) IsVisible() (bool, error) {\n\tl.log.Debugf(\"Locator:IsVisible\", \"fid:%s furl:%q sel:%q\", l.frame.ID(), l.frame.URL(), l.selector)\n\n\tvisible, err := l.frame.isVisible(l.selector, &FrameIsVisibleOptions{Strict: true})\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"checking is %q visible: %w\", l.selector, err)\n\t}\n\n\treturn visible, nil\n}\n\n// IsHidden returns true if the element matches the locator's\n// selector and is hidden. Otherwise, returns false.\nfunc (l *Locator) IsHidden() (bool, error) {\n\tl.log.Debugf(\"Locator:IsHidden\", \"fid:%s furl:%q sel:%q\", l.frame.ID(), l.frame.URL(), l.selector)\n\n\thidden, err := l.frame.isHidden(l.selector, &FrameIsHiddenOptions{Strict: true})\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"checking is %q hidden: %w\", l.selector, err)\n\t}\n\n\treturn hidden, nil\n}\n","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/locator.go#L265-L301","documentation":"Wrapped failure from Frame.isVisible while resolving visibility of the element matched by the locator's selector (strict mode forced via FrameIsVisibleOptions). Fires when the selector matches multiple elements (strict violation) or the visibility evaluation fails — a hidden element returns (false, nil), not this error.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:283 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Narrow the selector so it matches at most one element","Note visibility is checked immediately with no auto-wait; wait for the element first if it may not exist yet","Distinguish the returned error from a legitimate false (hidden) result"],"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"}