Cypress error CypressError: Timed out retrying after 4000ms: Expected to find element: `...`, but never found it
The selector is either wrong, or the element renders later than Cypress's default retry window, so check for a pending network request first.
Why this happens
- The selector itself is wrong or too specific
- The element renders only after an XHR/fetch resolves, and that hasn't happened within the timeout
- The element is inside an iframe, which Cypress doesn't traverse into by default
How to fix it
- Wait on the underlying request first: `cy.wait('@alias')` before asserting on the element
- Raise the timeout locally where it's genuinely justified: `cy.get(selector, { timeout: 10000 })`
- For iframes, use the `cypress-iframe` plugin or `cy.origin()` for cross-origin frames