Hi I am new to Cypress and trying to automate this scenario -
I have a dropdown like this having duplicate values:
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="volvo">Volvo</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Now I want to select the second Volvo that appears on the list. Things I have tried:
cy.get('select#cars').select('Volvo') //This selects the first Volvo
Edit: Now Based on the selection above, a new element is displayed on the webpage and I am checking the inner text of that element -
cy.get('selector', {timeout: 8000}).should('have.text', some text)
cy.get('selector', {timeout: 8000}).should('have.text', some text).cy.get('select#cars').select('Volvo').eq(1)