I'm writing something in selenium to automate a courseware my school made, I have this infinite loop that goes through the pages of a page and answers the questions until its done, but when I try this I get "No element" then the whole program stops, I've tried try/except NoSuchElementException but there's no option to retry the loop after that.
while True:
try:
clickable = driver.find_element(by=By.XPATH, value='/html/body/div[1]/div[1]/header/div/nav/button[3]/span').click() # arrows to go to next page
time.sleep(.3)
clickable = driver.find_element(by=By.XPATH, value='/html/body/div[2]/div[3]/div[3]/div[3]/div[2]/div[5]/button[3]').click() # show answers button
time.sleep(.3)
clickable = driver.find_element(by=By.XPATH, value='/html/body/div[1]/div[3]/div/button').click() # orange slides arrow
time.sleep(.3)
except NoSuchElementException:
# need to retry loop somehow
Tried to retry a loop, expected it to retry.