Cypress handles static dropdowns with the
help of 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>.
Syntax
Before
Before version 8.5.0,
the value argument could be the
value or the text content of the <option> to be selected
Consider the following snippet to understand the select command and its usage better.
Now to select a particular option,
we can either use its value or the text content
inside of <option> tag.
After
With the updated Cypress 8.5.0,
we can now select an option by index within the .select() command.
If we try to give a negative index,
a non-integer index,
or an out-of-range index then
Cypress will throw an error.