How to click an element that's not visible in Cypress?

Viewed 6294

I got this error running a test in Cypress:

Timed out retrying after 10050ms: cy.click() failed because this element is not visible:

How can I click on it anyway? It's just a menu item and I don't need it to be visible for my test.

1 Answers

You have to add {force: true} and it should make the click happen:

cy.get('locator').click({force: true})
Related