cypress element was detached from the dom

Viewed 39

when running on my site i'm trying to delete 3 element.

the first element is deleted without a problem. when trying to delete the second element, the test is failing with the error 'element was detached from the DOM.

I saw suggestions to use cy.wait() or assertions to solve the issue, but it made no difference whatsoever. this suggestions are referring to speed issue, so it's probably not the case

this is the code i'm using

cy.get('elem')
        .each(($btn) => {
        cy.wrap($btn).click() // clicking on delete
        cy.wait(3000)
    });

I tried to create another function to iterate the elements but i got the same error.

how can i solve the error on the second deletion?

0 Answers
Related