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

112
Visualizações
Cypress Finding element by partial element name

I would like to get this element in cypress tests but using only part of string without 'undefined'. How can I do that?

<line-chart-undefined tabindex="0"></line-chart-undefined>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It can be easily done with XPath.

  1. Install cypress-xpath plugin
  npm i -D cypress-xpath
  1. Then include in your project's cypress/support/index.js
  require('cypress-xpath')
  1. After installation your cy object will have xpath command
  cy.xpath("//*[starts-with(name(), 'line-chart-')]")

It'll find the element that matches the line-chart- tag

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