Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

for loop for calendar day selection using 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.')
 
PREVIOUS NEXT
Tagged: #loop #calendar #day #selection #selenium #python
ADD COMMENT
Topic
Name
2+6 =