{"record":{"id":"269ae0cdeaa4c818","repo":"grafana/k6","slug":"checking-is-q-enabled-w-269ae0","errorCode":null,"errorMessage":"checking is %q enabled: %w","messagePattern":"checking is %q enabled: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":241,"sourceCode":"\n\topts.Strict = true\n\teditable, err := l.frame.isEditable(l.selector, opts)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"checking is %q editable: %w\", l.selector, err)\n\t}\n\n\treturn editable, nil\n}\n\n// IsEnabled returns true if the element matches the locator's\n// selector and is Enabled. Otherwise, returns false.\nfunc (l *Locator) IsEnabled(opts *FrameIsEnabledOptions) (bool, error) {\n\tl.log.Debugf(\"Locator:IsEnabled\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\n\topts.Strict = true\n\tenabled, err := l.frame.isEnabled(l.selector, opts)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"checking is %q enabled: %w\", l.selector, err)\n\t}\n\n\treturn enabled, nil\n}\n\n// IsDisabled returns true if the element matches the locator's\n// selector and is disabled. Otherwise, returns false.\nfunc (l *Locator) IsDisabled(opts *FrameIsDisabledOptions) (bool, error) {\n\tl.log.Debugf(\"Locator:IsDisabled\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\n\topts.Strict = true\n\tdisabled, err := l.frame.isDisabled(l.selector, opts)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"checking is %q disabled: %w\", l.selector, err)\n\t}\n\n\treturn disabled, nil\n}","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/locator.go#L223-L259","documentation":"Wrapped failure from Frame.isEnabled while checking whether the element matched by the locator's selector is enabled (strict mode forced). Fires on selector mismatch (none or multiple matches) or a failed CDP evaluation — a disabled element returns (false, nil) rather than this error.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:241 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a selector matching exactly one element","Confirm the element is present before the check (locator.WaitFor)","Handle the error distinctly from the false enabled state in test logic"],"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"}