I make script which search for me intersted set of strings, but i have error. How i can resolve below problem:
links = driver.find_elements_by_xpath("xpath")
for x in range(0, len(links)):
driver.implicitly_wait(2)
links[x].click()
try:
driver.implicitly_wait(3)
DO something
driver.back()
print("Mission completed!!")
except (ElementNotVisibleException, NoSuchElementException):
driver.back()
print("No action")
Error:
selenium.common.exceptions.StaleElementReferenceException: Message: The element reference is stale. Either the element is no longer attached to the DOM or the page has been refreshed.
in line: links[x].click()