I would like to preface this question by saying that I have viewed all the other questions on this topic and attempted to implement the solutions but am still having no success. I am trying to click on the plus button in the recommendations screen on Quora:
Here is my code:
def recommendations():
time.sleep(10)
requests = WebDriverWait(driver, 10).until(unhidden_elements_located((By.TAG_NAME, 'svg')))
for i in range(12):
try:
ActionChains(driver).click(requests[i]).perform()
except selexcep.StaleElementReferenceException as e:
print(e)
After a wait to let the page load it gets a list of all the plus elements and then goes through and attempts to click them. I am pretty sure it is still getting the correct elements as this code used to work until it randomly started getting this error message:
Message: stale element reference: element is not attached to the page document
I am at a complete loss of how to solve this problem at this point.