我希望能够单击一个复选框并测试某个元素是否不再位于 Cypress 的 DOM 中。有人可以建议你如何做吗?
// This is the Test when the checkbox is clicked and the element is there
cy.get('[type="checkbox"]').click();
cy.get('.check-box-sub-text').contains('Some text in this div.')
我想做与上面测试相反的事情。
因此,当我再次单击它时,带有 check-box-sub-text
类的 div
不应位于 DOM 中。
最佳答案
嗯,这似乎有效,所以它告诉我我还有更多关于 .should() 的知识
cy.get('.check-box-sub-text').should('not.exist');
关于javascript - Cypress:测试元素是否不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48915773/