{"record":{"id":"a0facede1c7a1318","repo":"grafana/k6","slug":"setting-q-checked-to-v-w","errorCode":null,"errorMessage":"setting %q checked to %v: %w","messagePattern":"setting %q checked to (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/locator.go","lineNumber":167,"sourceCode":"\treturn l.frame.evaluateWithSelector(l.selector, pageFunc, args...)\n}\n\nfunc (l *Locator) EvaluateHandle(pageFunc string, args ...any) (JSHandleAPI, error) {\n\treturn l.frame.evaluateHandleWithSelector(l.selector, pageFunc, args...)\n}\n\n// SetChecked sets the checked state of the element using locator's selector\n// with strict mode on.\nfunc (l *Locator) SetChecked(checked bool, opts *FrameCheckOptions) error {\n\tl.log.Debugf(\n\t\t\"Locator:SetChecked\", \"fid:%s furl:%q sel:%q checked:%v opts:%+v\",\n\t\tl.frame.ID(), l.frame.URL(), l.selector, checked, opts,\n\t)\n\n\topts.Strict = true\n\topts.retry = true\n\tif err := l.frame.setChecked(l.selector, checked, opts); err != nil {\n\t\treturn fmt.Errorf(\"setting %q checked to %v: %w\", l.selector, checked, err)\n\t}\n\n\tapplySlowMo(l.ctx)\n\n\treturn nil\n}\n\n// Check on an element using locator's selector with strict mode on.\nfunc (l *Locator) Check(opts *FrameCheckOptions) error {\n\tl.log.Debugf(\"Locator:Check\", \"fid:%s furl:%q sel:%q opts:%+v\", l.frame.ID(), l.frame.URL(), l.selector, opts)\n\n\topts.Strict = true\n\topts.retry = true\n\tif err := l.frame.check(l.selector, opts); err != nil {\n\t\treturn fmt.Errorf(\"checking %q: %w\", l.selector, err)\n\t}\n\n\tapplySlowMo(l.ctx)","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/common/locator.go#L149-L185","documentation":"Returned by Locator.SetChecked when setting the element's checked state fails via Frame.setChecked; strict mode and retry are enabled, so it fires when the selector does not match exactly one checkbox/radio element or the state cannot be applied. The inputs at fault are the selector and the requested boolean state.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/locator.go:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Target an input element of type checkbox or radio with a selector matching exactly one node","Increase the timeout so the element becomes actionable","If the requested state cannot be achieved (e.g. element is disabled), adjust the script or the page state before calling SetChecked"],"exampleFix":null,"handlingStrategy":"retry","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"}