There are 2 options I would suggest here. First y...
# best-practices
t
There are 2 options I would suggest here. First you could ask your front-end devs to add a nice data-cy= tag on your button element so you can just call
cy.get('[data-cy=<tag here>]')
to get all the elements with that tag (i.e. will return 3 elements in your screenshot. The other approach I would use without front-end work would be something like
Copy code
js
cy.get('#headerHolder')
  .within(() => {
    cy.contains('Book now')
  })
First you're getting the main header, or higher level div which contains the other elements, then use the powerful cy.contains to look for the string within child divs. Something like this approach, although because you have multiple 'Book now' buttons you might want to be more specific of parent div before doing the cy.contains()