{"record":{"id":"1776b4c6fd600724","repo":"CloakHQ/CloakBrowser","slug":"element-selector-failed-visible-check-element","errorCode":null,"errorMessage":"Element ${selector} failed visible check: element is not visible","messagePattern":"Element (.+?) failed visible check: element is not visible","errorType":"exception","errorClass":"ElementNotVisibleError","httpStatus":null,"severity":"error","filePath":"js/src/human/actionability.ts","lineNumber":119,"sourceCode":"\n// ---------------------------------------------------------------------------\n// Pre-scroll actionability\n// ---------------------------------------------------------------------------\n\nasync function stealthActionable(\n  pageOrFrame: Page | Frame,\n  selector: string,\n  checks: ReadonlySet<CheckName>,\n): Promise<void> {\n  const world = getWorld(pageOrFrame);\n  if (!world) throw new StealthWorldUnavailableError();\n\n  const { status, data } = await evalParsed(world, buildActionableJs(selector));\n  if (status === UNSUPPORTED) throw new UnsupportedHumanizeSelectorError(selector);\n  if (status === EVALUATION_FAILED) throw new StealthEvaluationError(selector);\n  if (status === NOT_FOUND) throw new ElementNotAttachedError(selector);\n  if (status !== OK || !data) throw new StealthEvaluationError(selector);\n  if (checks.has('visible') && !data.visible) throw new ElementNotVisibleError(selector);\n  if (checks.has('enabled') && !data.enabled) throw new ElementNotEnabledError(selector);\n  if (checks.has('editable') && !data.editable) throw new ElementNotEditableError(selector);\n}\n\nasync function readBox(\n  pageOrFrame: Page | Frame,\n  selector: string,\n): Promise<{ x: number; y: number; width: number; height: number } | null> {\n  const world = getWorld(pageOrFrame);\n  if (!world) throw new StealthWorldUnavailableError();\n\n  const { status, data } = await evalParsed(world, buildBoxJs(selector));\n  if (status === OK && data?.box) return data.box;\n  if (status === NOT_FOUND) return null;\n  if (status === UNSUPPORTED) throw new UnsupportedHumanizeSelectorError(selector);\n  throw new StealthEvaluationError(selector);\n}\n","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/CloakHQ/CloakBrowser/blob/d6bad5de261bedf025280ace1d14e800aee13923/js/src/human/actionability.ts#L101-L137","documentation":"The element was found and evaluated, but with the 'visible' check requested the probe reported data.visible === false (zero size, display:none, visibility:hidden, or hidden ancestor).","triggerScenarios":"Calling ensureActionable with 'visible' in checks (default for click/hover/type actions) on an element that is hidden — e.g. a dropdown menu not yet opened, a modal overlay state, or an element mid-animation.","commonSituations":"Clicking menu items before opening the menu, tabs whose inactive panes are display:none, CSS animations mid-transition, off-screen carousels, or elements hidden by responsive breakpoints in emulated viewports.","solutions":["Trigger the UI state that reveals the element first (open the dropdown, switch tab, scroll into view)","Await visibility before acting: expect(locator).toBeVisible() or waitForSelector with state:'visible'","Increase the action timeout so animation/transition periods are covered","If acting on a hidden element is intentional, drop 'visible' from the checks set or use native Playwright"],"exampleFix":"// before\nawait humanClick(page, '[data-testid=\"menu-item-2\"]');\n// after\nawait humanClick(page, '[data-testid=\"menu\"]'); // open menu\nawait page.waitForSelector('[data-testid=\"menu-item-2\"]', { state: 'visible' });\nawait humanClick(page, '[data-testid=\"menu-item-2\"]');","handlingStrategy":"validation","validationCode":"await page.locator(sel).waitFor({ state: 'visible', timeout: 5000 });","typeGuard":"function isElementNotVisibleError(e: unknown): e is ElementNotVisibleError {\n  return e instanceof Error && /failed visible check/.test(e.message);\n}","tryCatchPattern":"try { await humanClick(page, sel); } catch (e) { if (isElementNotVisibleError(e)) { await openMenuFirst(); await humanClick(page, sel); } else throw e; }","preventionTips":["Open the containing UI state (menu/tab) before clicking children","Await visible state rather than relying on the internal poll","Account for entrance animations with adequate timeouts"],"tags":["visibility","actionability","dom","playwright"],"backgroundTag":"element-not-visible","analyzedSha":"d6bad5de261bedf025280ace1d14e800aee13923","analyzedAt":"2026-08-28T14:13:12.918Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}