https://cypress.io logo
Having trouble with comboboxes and datepickers
# i-need-help
i
Hello, I'm a newb to Cypress and I'm trying to figure out how to pick a date, say 01/01/1980, from a date picker. I am also trying to select a value from a combobox and while I can get Cypress to click the dropdown, I'm having trouble getting it to select a value. The elements are screenshotted along with the errors I'm getting. Below is the code I'm trying. For the DoB, I am trying this which does nothing: cy.get('input[name="birthDate"]').invoke('val','01/01/1980').should('eq', '01/01/1980').then((text) => { expect('01/01/1980').to.equal(text); }); For the sex selection, I am trying: cy.get('INPUT').parent('div.ui.search.selection.dropdown').click() cy.contains("Male").click() This opens the dropdown to make the selection but can't find the Male value. Thank you in advance for any help!
I figured out the date problem by changing it to: cy.get('input[name="birthDate"]') .type("1980-01-01"); I tried this earlier but was using mm-dd-yyyy format and it didn't work. Still looking for help with the combobox issue.
g
it would be hard to help without a reproducible example
2 Views