samedi 4 juillet 2020

How to check if the element with visibility exists or not cypress

Is there any way to check if the element with visibility exists or not

cy.get("[data-ta='member_account_switch']:visible")

event though there are two elements with same data key exists on the dom but both are not visible I just want to check if the visible element exists or not

cy.get("[data-ta='member_account_switch']:visible").should('not.exists')

this above statement does not work as cy.get("[data-ta='member_account_switch']:visible") is trying to find the element. and I get the below error

Timed out retrying: Expected to find element: [data-ta='member_account_switch']:visible, but never found it.

can someone help here? Thanks

Aucun commentaire:

Enregistrer un commentaire