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.

Add a way to clear selection with `cy.select()`

See original GitHub issue

This Stack Overflow question points out that cy.select() can’t clear a selection, and apparently, neither can commands like cy.clear(): https://stackoverflow.com/questions/56340978/how-do-i-clear-a-select-input-using-cypress

Things that should work, but don’t:

  • cy.select([]) should cause no elements to be selected
  • cy.clear() with a <select> subject should cause no elements to be selected

Also, maybe cy.select() or cy.select(undefined) should also clear the selection.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
signalpcommented, Apr 3, 2021

Hi, is this issue still open and available for grabs?

Still returning “cy.select() failed because it could not find a single <option> with value or text matching: ``” for me on select multiple (trying .select([]), .select(null), .clear(), all fail)

2reactions
florenceshelleycommented, Oct 21, 2020

Hi, is this issue still open and available for grabs?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do i clear a multi-select input using Cypress?
You can use cy.invoke() to call the .val('') method on the underlying JQuery element, which will cause it to be cleared.
Read more >
select - Cypress Documentation
Note: Passing an array into cy.select() will select only the options matching values in the array, leaving all other options unselected (even those...
Read more >
Cypress 8.6.0 - Unselect all selected options with cy.select([])
With the updated Cypress 8.6.0, we can use cy.select([]) to clear any selected options in a multi-value select. Previously, an error ...
Read more >
How to Handle Dropdown in Cypress | BrowserStack
Cypress has the chaining command select() using which can easily select the drop-down values. The chaining command select() is used in ...
Read more >
Cypress to handle single or multi selection of items ... - YouTube
This video will explain how to select or multiple items from Select or dropdown elements.Also you will learn how to verify the selected...
Read more >

github_iconTop Related Medium Post

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