How to select calender month using Selenium Select method using python selenium


I am trying to select a month from the calender using Select method of selenium in python.
URL of site is: .
I am getting timeout error and the driver is unable to find the select element of calender. Code is as follows:

wait = WebDriverWait(driver, 10)
            EC.presence_of_element_located((By.ID, 'datepicker'))
select_month = Select(wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="pika-title-yj"]/div[1]/select'))))

I am getting a timeout error on Select method as this:

select_month = Select(wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="pika-title-yj"]/div[1]/select'))))

File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\support\", line 89, in until
    raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace: Backtrace:
        Ordinal0 [0x00636463+2188387]
        Ordinal0 [0x005CE461+1762401]
        Ordinal0 [0x004E3D78+802168]
        Ordinal0 [0x00511880+989312]
        Ordinal0 [0x00511B1B+989979]
        Ordinal0 [0x0053E912+1173778]
        Ordinal0 [0x0052C824+1099812]
        Ordinal0 [0x0053CC22+1166370]
        Ordinal0 [0x0052C5F6+1099254]
        Ordinal0 [0x00506BE0+945120]
        Ordinal0 [0x00507AD6+948950]
        GetHandleVerifier [0x008D71F2+2712546]
        GetHandleVerifier [0x008C886D+2652765]
        GetHandleVerifier [0x006C002A+520730]
        GetHandleVerifier [0x006BEE06+516086]
        Ordinal0 [0x005D468B+1787531]
        Ordinal0 [0x005D8E88+1805960]
        Ordinal0 [0x005D8F75+1806197]
        Ordinal0 [0x005E1DF1+1842673]
        BaseThreadInitThunk [0x774CFA29+25]
        RtlGetAppContainerNamedObjectPath [0x779E7A9E+286]
        RtlGetAppContainerNamedObjectPath [0x779E7A6E+238]

I have tried to click the month element but I am unable to do so as well. Please let me know what is wrong here.


The dates of the calendar are <button> tags


So you can’t use Select() class.


To chose a date e.g. July 3rd, 2022 instead of presence_of_element_located() you need to induce WebDriverWait for the element_to_be_clickable() and you can use the following css_selector based locator strategies:

  • Code block:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button#onetrust-accept-btn-handler"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#datepicker"))).click()
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-pika-year='2022'][data-pika-month='6'][data-pika-day='3']"))).click()
  • Note : You have to add the following imports :

    from import WebDriverWait
    from import By
    from import expected_conditions as EC

Answered By – undetected Selenium

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published