This is the element.
<input aria-invalid="false" autocomplete="off" placeholder="Category" type="text" class="MuiOutlinedInput-input MuiInputBase-input MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused MuiAutocomplete-input MuiAutocomplete-inputFocused css-16sx77j" aria-autocomplete="list" autocapitalize="none" spellcheck="false" value="" id="mui-621338585" aria-controls="mui-621338585-listbox" aria-activedescendant="mui-621338585-option-3"> This is a listbox with the name Category that contains various options when I click the dropdown arrow. The number after "mui-" is dynamic.
This is what I tried:
cy.get('[id^=”mui-"]').eq(2); Also tried:
cy.get('[id^=”mui-"]') .find('[aria-activedescendant*="-option-"]') .eq(2); And tried:
cy.get('[aria-activedescendant*="-option-2"]'); Could someone point me in the right direction to select an option from the listbox?