I am writing a code to download some files from a webpage. The code starts fine and there are 27 files to download, but after the first 5 downloads, I get a ElementClickInterceptedException error for the following elements. Can anyone tell me why the code stops downloading the rest of the files?
Here is the (part of the) code:
actions = ActionChains(driver)
xlbr2 = driver.find_elements_by_xpath("//*[@class='mf mf-xbrl']")
print(len(xlbr2))
for link in range(4, 27):
time.sleep(2)
print(link)
try:
xlbr2 = driver.find_elements_by_xpath("//*[@class='mf mf-xbrl']")
xlbr2 = driver.find_elements_by_xpath("//*[@class='mf mf-xbrl']")[link]
actions.move_to_element(xlbr2).perform()
xlbr2.click()
# xlbr2 = driver.find_elements_by_xpath("//*[@class='mf mf-xbrl']")[link].click()
time.sleep(1)
download = driver.find_element_by_xpath('/html/body/div[2]/div[8]/div/div/div/div[1]/div/div[2]/ul/div/div[4]/a/button/i')
print('downloading file...')
download.click()
time.sleep(2)
driver.back()
# time.sleep(2)
except Exception as err:
print(f"{type(err).__name__} was raised: {err}")