I'm trying to click on an li element in a ul dropdown list. I want to select "Last Month" but get this error: Message: no such element: Unable to locate element
Here's my code:
def click_on(xpath):
timeout = time.time() + 30
while True:
try:
driver.find_element(By.XPATH, xpath).click()
break
except Exception:
if time.time() > timeout:
msgbox('Process timed out after 30 seconds.', 'Error')
exit()
click_on('//*[@id="popover_otrppv916b"]/div/div[2]/div[1]/div/div/div/div/ul/li[9]/div/span')
Here's the html:
I've also tried clicking on just the <div>
tag, and just the <li>
tag (instead of the <span>
tag) and I get the same error.