Skip to content
masterclass Buddy

Cypress · Function

cy.contains

cy.contains() finds a DOM element by its text, number, or regular expression. It searches the page or the current subject and yields one element for further commands.

Last updated

Syntax

cy.contains(content)
cy.contains(content, options)
cy.contains(selector, content)
cy.contains(selector, content, options)

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

Subscribe
  • cy.get()
  • cy.shadow()
  • cy.within()
  • cy.click()
  • cy.should()
  • cy.filter()
  • cy.not()

Source: cy.contains() | Cypress API Documentation. Checked 2026-11-03.