Skip to content
masterclass Buddy

Cypress · Matcher

have.length

have.length checks that a Cypress subject has an exact length. It is commonly used with cy.get() to verify the number of matching elements.

Last updated

Syntax

cy.get(selector).should('have.length', expectedLength)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • cy.get
  • should
  • and
  • not.have.length

Source: Assertions in Cypress | Cypress Documentation. Checked 2026-11-03.