Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!