Cypress · Method
cy.focus
Focus one DOM element or the window in a Cypress test. The subject must contain one focusable element, and Cypress yields that same subject.
Last updated
Syntax
.focus()
.focus(options)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
.blur().click()cy.focused()cy.press().type()