I have a link I need to click on:
<a id="selectLink">...</a>
I do it like so:
WebDriverWait(browser, timeout).until(EC.element_to_be_clickable((By.ID, "selectLink")))
but for some reason the link doesnt click, or it does and nothing happens. When I do it manually it works. I even try to put it in a loop and click on it until something happens, but then it works at times and sometimes it doesn't:
while True:
try:
WebDriverWait(browser, timeout).until(EC.element_to_be_clickable((By.ID, "selectLink"))).click()
except Exception:
break
I can't tell what is the problem.
For example:
while True:
try:
WebDriverWait(browser, timeout).until(EC.element_to_be_clickable((By.ID, "selectLink"))).click()
print(len(browser.find_elements_by_id("selectLink")))
print('click')
except Exception:
print(len(browser.find_elements_by_id("selectLink")))
print('break')
break
It gives me:
1
click
1
click
1
break
And still nothing happens. My question is how come the loop breaks even tho the link is still accessible, since the length is still 1?