cypress: cy.select() won't work, need to force and select twice

Current behavior:

cy.get('#element').select(value) //won't work

cy.get('#element').select(value, { force: true });
cy.get('#element').select(value, { force: true }); //only works calling twice, using force

Desired behavior:

cy.get('#element').select(value) //want it to work like this

Versions

Cypress 3.3.1 Chrome 74 Windows 10 x64

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 11
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Hi @jennifer-shehane, I’m also facing the same issue in cypress 8.3.0.

Here is a snippet using which you can reproduce the issue:

cy.visit('https://apply.kiwibank.co.nz/credit-cards/low-rate-visa/my-personal-details');
cy.get('#timeAtAddress').select('0 - 6 months');

here drop-down is not selected on screen until I run line 2 twice. Cypress doesn’t show any error but the drop-down is also not selected on the browser.

I’m using Windows 10 Cypress 8.3.0

Please advise.

I’m still getting this occasionally in Cypress 12

works for me when i use interpolation

cy.get('#element').should('be.visible').select(`${value}`)

I see similar behavior, in cypress 8.5.0. I wait for the ajax call to load the select options and then sometimes it selects and sometimes it does not select. But it continues the test. Selecting it twice does not work, because on the second try i get an detached from the DOM. error.