Click here to Skip to main content
15,795,789 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am automating a script to book appointments.

Here is a snap of the datepicker. When available, dates are in green.[^]

I can't know the attribute of the available dates until they are visible on the calendar.

I want to find a way to iterate all dates in the datepicker, loop until available dates are found then select one of them randomly.

What I have tried:

all_dates = driver.find_elements(By.XPATH, "//div[@class='datepicker-days']/table/tbody/tr/td")
for date in all_dates:
    if date == driver.find_element(By.XPATH, "//div[@class='datepicker-days']/table/tbody/tr/td[not(contains(@class, 'disabled'))]"):
Updated 3-Feb-23 6:09am
Elouali Issam 3-Feb-23 14:58pm    
Anyone please?
Elouali Issam 5-Feb-23 16:07pm    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900