mercredi 20 mars 2019

In Cypress how to count a selection with same ID and get the length?

I have a such HTML code.

<div id ='pages'>
    <div id='wrapper'>1 </div>
    <div id='wrapper'>2 </div>
</div>

I am want to find elements count with id wrapper. I using Cypress. I'm starting to learn Cypress. If I try:

cy.get('div#wrapper').should('have.length', 2)

I get AssertionError:

CypressError: Timed out retrying: expected 1 to equal 2

Aucun commentaire:

Enregistrer un commentaire