Powered by
Get the element count and assign to a variable if ...
# i-need-help
p
plain-potato-68806
05/05/2023, 8:22 PM
I am trying to get the element count if the elements exists to assign to a variable and used something like:
Copy code
javascript cy.get('.my-class-name).then((list) => { const count = list.length })
However, the test will fail when the element is not visible at all. Please could you help?
Previous
Next