Sometimes, we want to wait for element to disappear in Cypress and JavaScript.
In this article, we’ll look at how to wait for element to disappear in Cypress and JavaScript.
How to wait for element to disappear in Cypress and JavaScript?
To wait for element to disappear in Cypress and JavaScript, we call the waitUntil method.
For instance, we write
cy.waitUntil(() => {
return cy.get("element").should("not.exist");
});
to call waitUntil with a callback that returns the condition that the element with selector element shouldn’t exist.
Conclusioin
To wait for element to disappear in Cypress and JavaScript, we call the waitUntil method.