{"record":{"id":"d095d87f7459c43c","repo":"grafana/k6","slug":"checking-element-is-editable-w","errorCode":null,"errorMessage":"checking element is editable: %w","messagePattern":"checking element is editable: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle.go","lineNumber":1080,"sourceCode":"}\n\n// IsDisabled checks if the element is disabled.\nfunc (h *ElementHandle) IsDisabled() (bool, error) {\n\tok, err := h.isDisabled(h.ctx, 0)\n\t// We don't care anout timeout errors here!\n\tif err != nil && !errors.Is(err, ErrTimedOut) {\n\t\treturn false, fmt.Errorf(\"checking element is disabled: %w\", err)\n\t}\n\n\treturn ok, nil\n}\n\n// IsEditable checks if the element is editable.\nfunc (h *ElementHandle) IsEditable() (bool, error) {\n\tok, err := h.isEditable(h.ctx, 0)\n\t// We don't care anout timeout errors here!\n\tif err != nil && !errors.Is(err, ErrTimedOut) {\n\t\treturn false, fmt.Errorf(\"checking element is editable: %w\", err)\n\t}\n\n\treturn ok, nil\n}\n\n// IsEnabled checks if the element is enabled.\nfunc (h *ElementHandle) IsEnabled() (bool, error) {\n\tok, err := h.isEnabled(h.ctx, 0)\n\t// We don't care anout timeout errors here!\n\tif err != nil && !errors.Is(err, ErrTimedOut) {\n\t\treturn false, fmt.Errorf(\"checking element is enabled: %w\", err)\n\t}\n\n\treturn ok, nil\n}\n\n// IsHidden checks if the element is hidden.\nfunc (h *ElementHandle) IsHidden() (bool, error) {","sourceCodeStart":1062,"sourceCodeEnd":1098,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/element_handle.go#L1062-L1098","documentation":"Returned by ElementHandle.isEditable() when the state probe fails with a non-timeout error. Timeout results are deliberately ignored (they simply mean 'not editable yet'), so this error indicates a stale handle, a destroyed execution context (navigation), a CDP failure, or a closed page/browser.","triggerScenarios":"Calling isEditable() on a detached or pre-navigation handle; while the page is navigating; after page.close(); when the browser process has crashed or the session dropped.","commonSituations":"Form fields re-rendered by frameworks between query and probe; probing editability immediately after submit navigates away; racing browser shutdown.","solutions":["Re-query the handle immediately before isEditable()","Wait for the element: page.waitForSelector(sel, { state: 'attached' })","Verify the page is alive before the probe","Handle the thrown error separately from a false result"],"exampleFix":"// before\nconst editable = await h.isEditable(); // stale handle\n// after\nconst el = await page.$('#notes');\nconst editable = await el.isEditable();","handlingStrategy":"try-catch","validationCode":"const el = await page.$('#notes');\nif (el && (await el.isVisible())) {\n  const editable = await el.isEditable();\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await handle.isEditable();\n} catch (e) {\n  if (String(e).includes('checking element is editable')) {\n    const fresh = await page.$(sel);\n    return fresh ? fresh.isEditable() : false;\n  }\n  throw e;\n}","preventionTips":["Timeouts are swallowed; errors mean stale handles or dead pages","Re-query before probing editability","Sequence probes after waitForLoadState when navigation is involved"],"tags":["browser","element-handle","is-editable","detached-handle"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}