Reputation: 63
Here I am using cypress tool for automation. How to write code for dropdown menu
I just done like this way but its not working
cy.get('.dropdown-heading-dropdown-arrow').click()
cy.get('#0').click()
Upvotes: 4
Views: 11246
Reputation: 465
After dropdown opens search for the option with required text.
Not sure which selector might work for you, either role
or .MuiMenuItem-root
looks best, or try just getting any element with the text
cy.get('.dropdown-heading-dropdown-arrow').click()
cy.contains('[role="option"]', 'Select All')
.click()
// or
cy.contains('.MuiMenuItem-root', 'Select All')
.click()
// or
cy.contains('Select All')
.click()
Upvotes: 6
Reputation: 573
Have a look at this. Gives a good explanation as well.
select dropdownlist item using cypress
Otherwise you can just get it by css selector, xpath or you can do cy.contains
Upvotes: 3