Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

88
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

You can use contains with selector and text something like:

cy.contains('a', 'CONTENT').click()
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda