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

76
Vistas
Cypress select does not have value

I´m writing a Cypress test in which I want to confirm that a certain value is not shown. I want to check that my select element does not have an option with a certain value.

An example:

<select>
 <option>A</option>
 <option>B</option>
</select>

So now I want to check that there isn´t an option with value "C"

cy.get('select') // <-- here I want to verify that option "C" doesn´t exist

Can someone help me evaluate this?

Thanks.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Try this:

cy.get('select option:contains(C)').should('not.exist')
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can do like this:

  1. For a specific position, you can check like this:
cy.get('select option').eq(0).should('not.have.text', 'C')
  1. You can also loop over all the Options and check that 'C' is not present:
cy.get('select option').each(($ele) => {
  expect($ele).to.not.have.text('C')
})
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