{"record":{"id":"4ee7f50e6ce4da39","repo":"grafana/k6","slug":"checking-element-w","errorCode":null,"errorMessage":"checking element: %w","messagePattern":"checking element: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1335,"sourceCode":"\t\treturn cmp.Compare(a.index, b.index)\n\t})\n\n\tels := make([]*ElementHandle, 0, len(indexedElems))\n\tfor _, ie := range indexedElems {\n\t\tels = append(els, ie.elem)\n\t}\n\n\treturn els, nil\n}\n\n// SetChecked checks or unchecks an element.\nfunc (h *ElementHandle) SetChecked(checked bool, opts *ElementHandleSetCheckedOptions) error {\n\tsetChecked := func(apiCtx context.Context, handle *ElementHandle, p *Position) (any, error) {\n\t\treturn nil, handle.setChecked(apiCtx, checked, p)\n\t}\n\tsetCheckedAction := h.newPointerAction(setChecked, &opts.ElementHandleBasePointerOptions)\n\tif _, err := call(h.ctx, setCheckedAction, opts.Timeout); err != nil {\n\t\treturn fmt.Errorf(\"checking element: %w\", err)\n\t}\n\n\tapplySlowMo(h.ctx)\n\n\treturn nil\n}\n\n// Uncheck scrolls element into view, and if it's an input element of type\n// checkbox that is already checked, clicks on it to mark it as unchecked.\nfunc (h *ElementHandle) Uncheck(opts *ElementHandleSetCheckedOptions) error {\n\treturn h.SetChecked(false, opts)\n}\n\n// Check scrolls element into view, and if it's an input element of type\n// checkbox that is unchecked, clicks on it to mark it as checked.\nfunc (h *ElementHandle) Check(opts *ElementHandleSetCheckedOptions) error {\n\treturn h.SetChecked(true, opts)\n}","sourceCodeStart":1317,"sourceCodeEnd":1353,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/js/modules/k6/browser/common/element_handle.go#L1317-L1353","documentation":"Returned by ElementHandle.SetChecked when the internal setChecked pointer action (scroll into view, actionability checks, click to toggle) fails. The wrapped error holds the actual cause: element not visible/enabled/editable, hit-target interception, timeout, or detachment. It is a wrap-only site; the retry logic lives in newPointerAction.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/element_handle.go:1335 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the element to be actionable (visible, enabled, editable) before setting checked","Increase the timeout option","Use force:true to skip actionability checks when appropriate","Verify the element is an input that supports checking"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}