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

98
Vistas
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 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