{"record":{"id":"06312bfd9088af84","repo":"microsoft/playwright","slug":"element-is-not-visible","errorCode":null,"errorMessage":"Element is not visible","messagePattern":"Element is not visible","errorType":"exception","errorClass":"NonRecoverableDOMError","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/dom.ts","lineNumber":342,"sourceCode":"      if (retry) {\n        progress.log(`retrying ${actionName} action${options.trial ? ' (trial run)' : ''}`);\n        const timeout = waitTime[Math.min(retry - 1, waitTime.length - 1)];\n        if (timeout) {\n          progress.log(`  waiting ${timeout}ms`);\n          const result = await progress.race(this.evaluateInUtility(([injected, node, timeout]) => new Promise<void>(f => setTimeout(f, timeout)), timeout));\n          if (result === 'error:notconnected')\n            return result;\n        }\n      } else {\n        progress.log(`attempting ${actionName} action${options.trial ? ' (trial run)' : ''}`);\n      }\n      if (!options.skipActionPreChecks && !options.force && !noAutoWaiting)\n        await this._frame._page.performActionPreChecks(progress);\n      const result = await action(progress, retry);\n      ++retry;\n      if (result === 'error:notvisible') {\n        if (options.force || noAutoWaiting)\n          throw new NonRecoverableDOMError('Element is not visible');\n        progress.log('  element is not visible');\n        continue;\n      }\n      if (result === 'error:notinviewport') {\n        if (options.force || noAutoWaiting)\n          throw new NonRecoverableDOMError('Element is outside of the viewport');\n        progress.log('  element is outside of the viewport');\n        continue;\n      }\n      if (result === 'error:optionsnotfound') {\n        if (noAutoWaiting)\n          throw new NonRecoverableDOMError('Did not find some options');\n        progress.log('  did not find some options');\n        continue;\n      }\n      if (result === 'error:optionnotenabled') {\n        if (noAutoWaiting)\n          throw new NonRecoverableDOMError('Option being selected is not enabled');","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/dom.ts#L324-L360","documentation":"During the action retry loop (_retryAction), when an action returns 'error:notvisible' the normal behavior is to log and keep auto-waiting. But if force:true or noAutoWaiting is set, Playwright cannot retry, so it throws a NonRecoverableDOMError('Element is not visible') immediately. The element exists but has zero visible bounding box (display:none, visibility:hidden, opacity:0, or off-flow).","triggerScenarios":"Calling click()/fill()/press() etc. with { force: true } on an element that is present in the DOM but not rendered visible; acting with force on an element inside a hidden tab/accordion; element whose CSS makes it non-visible at action time.","commonSituations":"Using force:true to bypass actionability checks when the element is genuinely hidden; toggling UI state that hasn't completed its animation; clicking inside a container that is display:none until a parent action runs.","solutions":["Remove force:true so Playwright's auto-wait retries until the element becomes visible.","Ensure the element is visible before the forced action: await locator.waitFor({ state: 'visible' }).","Fix the page flow so the element is visible when acted upon (open the tab/accordion first).","If the element is intentionally hidden and you must interact, scroll/expand it via the UI first."],"exampleFix":"// before\nawait page.locator('#hidden-btn').click({ force: true }); // throws\n// after\nawait page.locator('#open-panel').click(); // make it visible\nawait page.locator('#hidden-btn').click(); // auto-wait handles it","handlingStrategy":"retry","validationCode":"// Let Playwright auto-wait by not forcing; or pre-check visibility.\nawait locator.waitFor({ state: 'visible' });\nawait locator.click(); // no force — retries until visible","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid force:true for elements that may be hidden; rely on auto-wait.","Open/expand the containing UI so the element is visible before acting.","Pre-check with locator.isVisible() or waitFor({ state: 'visible' })."],"tags":["dom","actionability","force"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}