Cypress error

cy.type() failed because it requires a valid DOM element

The locator resolved to nothing (or to a detached element) right at the moment cy.type() tried to act on it.

Why this happens

How to fix it

  1. Assert existence and visibility before typing, in the same chain: `cy.get(sel).should('be.visible').type('text')`