I am an 'ISTQB-TAE' Certified engineer having a passion for building quality software. Also, being a true 'Don Norman' fan, I am a UX Design and Research enthusiast with a strong appreciation for clean and intuitive designs. In between tasks you can find me grooving to my favorite songs or sipping tea with my family!
1 minute read
Cypress handles static dropdowns with the
help of the select() command.
For a static dropdown, the tag name of the element should be <select> and
its child elements should have the tag name <option>.
We can select values by passing texts or indexes.
In this blog,
we will see how we can unselect all dropdown values by passing an empty array.
Syntax
Before
Before version 8.6.0,
we would get an error if an empty array was passed into cy.select().
Consider the following snippet to understand the usage better.
It follows the existing pattern that passing an array into cy.select() will unselect the other options.
After
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 would be thrown if an empty array was passed into cy.select().