Skip to content
masterclass Buddy

Cypress · Matcher

have.text

Use Cypress assertions or jQuery methods to read element text and input values. Use .then() with .get(0) when you need the native DOM element.

Last updated

Syntax

cy.get(selector).should('have.text', expected)
cy.get(selector).should('have.value', expected)
cy.get(selector).invoke('text')
cy.get(selector).invoke('val')

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

Subscribe
  • cy.get()
  • cy.contains()
  • cy.invoke()
  • cy.then()
  • cy.should()
  • Variables and Aliases

Source: Frequently asked questions: Cypress App. Checked 2026-11-03.