Для петли для выбора дня календаря с использованием Selenium Python

x = list(range(1, 32))

for expected_from_day in x:
    try:
        from_day = driver.find_element(By.XPATH, f"//table/tbody/tr/td/a[text()='{expected_from_day}']")
        from_day.click()
        break
    except Exception:
        continue
    else:
        raise Exception('The from_day for loop failed.')
Micah M