Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

81
Views
click on href without id or class cypress

I'm trying to click an href element using cypress I've wondered if I can access it by its content ex:

<a href=example.com>CONTENT</a>

but I couldn't find anything online.

I've tried using something like that:

cy.get('a[href*="url"]').click()

but it also didn't work

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can use contains to select elements by textual content, like this:

cy.get('a').contains('CONTENT').click();

Note that the used href attribute value is invalid, protocol and quotes are missing, should be something like this:

<a href="https://example.com/">CONTENT</a>

Documentation can be found here: https://docs.cypress.io/api/commands/contains

about 4 years ago · Juan Pablo Isaza Report

0

You can use contains with selector and text something like:

cy.contains('a', 'CONTENT').click()
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!