select(value) works fine but what if I cannot get the value ? I've tried using $ to get current option value and then use it as a parameter but it doesn't work.
At least I can select the first option without knowing value or any other workaround ? Thanks.
Cypress: ^3.1.0
@FrontendSophie I think this code can help you, it selects the first option of the select.
cy.get('select').then(($select) => {
const opt = $select.find('option:nth-child(2)')
$select.val(opt.attr('value'))
return $select
}).trigger('change')
@raphaelcunha cheers
Most helpful comment
@FrontendSophie I think this code can help you, it selects the first option of the select.