I have Mat-select dropdown as follows
<mat-form-field>
<mat-label>Gender</mat-label>
<mat-select id="gender" required formControlName="gender">
<mat-option id="Male" value="male"> Male </mat-option>
<mat-option value="female"> Female </mat-option>
</mat-select>
</mat-form-field>
I'm trying to use Cypress to select male or female from the field.
cy.get('mat-select').click().select('Male')
With the above code I get the following error:
CypressError: cy.select() can only be called on a <select>. Your subject is a: <mat-select>
I need some help in fixing this, thank you.
The code that worked for me.
cy.get('#gender').click().then(() => {
cy.get('#male').click()
})