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

225
Visualizações
How do I select a checkbox when I get a path error. I am doing this in cypress
cy.get('[data-ng-show="destact['dest'].length > 0"] > .checkbox-block > :nth-child(1) > .ng-binding').click()

the above is the path to my checkbox. As there are two single quotes, I tried to concatenate them as well but no luck

cy.get('[data-ng-show="destact['+'dest'+'].length > 0"] > .checkbox-block > :nth-child(1) > .ng-binding').click()
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Back-ticks are also valid delimiters for the selector,

cy.get(`[data-ng-show="destact['dest'].length > 0"] > .checkbox-block > :nth-child(1) > .ng-binding`)
about 4 years ago · Juan Pablo Isaza Relatório

0

Assuming that the selector [data-ng-show="destact['dest'].length > 0"] > .checkbox-block > :nth-child(1) > .ng-binding is a correct selector, you can use backslash to escape the single quotes:

cy.get('[data-ng-show="destact[\'dest\'].length > 0"] > .checkbox-block > :nth-child(1) > .ng-binding').click()
about 4 years ago · Juan Pablo Isaza Relatório

0

Two problems seem to be occurring when selecting this attribute with the complex expression

<div data-ng-show="destact['dest'].length > 0" ></div>
  • the quote marks conflict
  • the square brackets are ending the selector prematurely.

This will work if there's only one element with expression starting destact

cy.get("div[data-ng-show^=destact]")
  .should('have.attr', 'data-ng-show', "destact['dest'].length > 0")
  .find('.checkbox-block > :nth-child(1) > .ng-binding')

If there's more than one element selected by cy.get("div[data-ng-show^=destact]"), you can add a filter for the exact expression

cy.get("div[data-ng-show^=destact]")
  .filter((i, el) => {
    return Cypress.$(el).attr('data-ng-show') === "destact['dest'].length > 0"
  })
  .find('.checkbox-block > :nth-child(1) > .ng-binding')
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