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

97
Visualizações
Cypress seems to target the wrong element

When selecting elements by id using cy.get() and then typing into them using .type() the wrong element is typed into. This happens intermittently in a number of tests I have written. The get seems to select the correct element, but then the type inputs in a different one.

Example:
element correctly selected
value entered into wrong element

Ive tried a number of things here. cy.get('#elementid').clear().type('new text') was how I used to do this, but changed to cy.get('#elementid').type('{selectall}new text'). The new method causes this issue to happen far less often, but it still does.

The complete command used in the example screenshots is using a loop to build the element IDs, but this issue also appears when selecting elements without a loop.

Cypress.Commands.add('new_supplier_preisanfrage', (customerFullName, discount, priceList) => {
    cy.open_supplier_preisanfrage_dialog(customerFullName)
    cy.get('#1917240871_' + (priceList.length - 1) + '_price').should('exist').then(() => {
        for (var i = 0; i < priceList.length; i++) {
            var price = priceList[i]
            cy.get('#1917240871_' + i + '_price').type('{selectall}' + price)
            cy.get('#1917240871_' + i + '_discount').type('{selectall}' + discount)
        }
    }).then(() => {
        cy.get('#price-inquiry-edit-save-btn').click()
    })
})

You can see here that I also tried using .then() to wait until all the fields have been loaded into the DOM.

So, How do I debug this further? Is this a known issue? What am I doing wrong here?

about 4 years ago · Juan Pablo Isaza
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