Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How do I select the time from the dropdown widget using cypress

I've scenario to automate in cypress, the test case is to set time for signing appointment either from dropdown or by typing time and selecting from dropdown. Can anyone tell please me how to set time.

I tried with different approach of code it din't work to me

cy.get('#appointment-form_appointmentTime li:nth-child(1)').type('time, 10:30pm').click();
    
cy.get('.ant-select.ant-select-single.ant-select-allow-clear.ant-select-show-arrow.ant-select-open.ant-select-show-search li:nth-child(1)').type('time, 10:30pm').click();

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

According to your DOM screenshot you should be able to reference the input field of your dropdown, type in and assert some value as follows:

Get input by id:

cy.get('#appointment-form_appointmentTime').clear().type('some date').should('have.value', 'some date');

or alternatively by class:

cy.get('ant-select-selection-search-input').clear().type('some date').should('have.value', 'some date');

I'm not sure why you are using cy.click() on 1. but I assume that you are trying to click on a value in your dropdown. However, to do this you must first select the appropriate dropdown item with another cy.get() and then click on it with cy.click().

I would have provided the sample code for this as well, however the HTML code for your dropdown entries is missing from the question.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!