Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

254
Visualizações
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>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

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>.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda