question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
aasthasanghicommented, Aug 18, 2021

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.

1reaction
npostmacommented, Oct 13, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

select - Cypress Documentation
select() is an action command that follows the rules of Actionability. However, passing { force: true } to . select() will not override...
Read more >
select react-select dropdown list option using cypress
On Cypress 4.2.0 and react-select 3.0.8 pressing enter twice is working for me:
Read more >
cypress fix this problem, or use {force: true} to disable error ...
We have decided not to implement this {force: true} option because there is no way to retrieve the value from selected disabled options...
Read more >
cypress-io/cypress - Gitter
I have tried several ways to select a value in my dropdown, but it won't work. ... doesn't work unfortunately, i get this...
Read more >
Actions | Cypress examples (v7.1.0) - Gleb Bahmutov
To type into a DOM element, use the .type() command. ... close it cy.get('.action-btn') .click() .should('not.have.attr', ... Double click to edit.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found