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

254
Vistas
How to target a checkbox that has no id, name and class attribute?

I am trying to target a checkbox using cypress that has no id and classname and assert it is checked on click. I have tried a couple of ways including this and it does not work.

cy.get('[type=checkbox]').select('Store')

The code looks like this

<h2>
  <input type="checkbox" 
         tri-state="" 
         ng-model="data.root" 
         class="ng-valid ng-touched ng-dirty ng-valid-parse">Store 
</h2>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

.select() is for dropdowns (well some of them), but .check() is for checkboxes docs

cy.contains('h2', 'Store')
  .find('[type=checkbox]')
  .check()

There's something a little bit off with the html, the <input> isn't closed. Probably does not matter, but to be safe id the <h2> with the "Store" text, then .find() takes you inside the <h2>.

over 4 years ago · Santiago Trujillo 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