Add a way to clear selection with `cy.select()`
See original GitHub issueThis 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 selectedcy.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:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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)
Hi, is this issue still open and available for grabs?