Get the length of element matches from the get command #14171
Unanswered
chrisenitan
asked this question in
Questions and Help
Replies: 1 comment 1 reply
-
You can use the cy.get('button').its('length').should('eq', 4)
cy.get('button').its('length').then((length) => {
expect(length).to.eq(4)
})
cy.get('button').then(($buttons) => {
expect($buttons.length).to.eq(4)
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Using the Cypress get command in the test runner, cypress outputs the amount of element matches found for the selector asked for. Is there a way to get this value or length?
Beta Was this translation helpful? Give feedback.
All reactions