selenium (python) raises StaleElementReferenceException and does not continue to download all webdriver.find_elements_by_partial_link_text() selenium (python) raises StaleElementReferenceException and does not continue to download all webdriver.find_elements_by_partial_link_text() selenium selenium

selenium (python) raises StaleElementReferenceException and does not continue to download all webdriver.find_elements_by_partial_link_text()


The links list is a list of elements on the webpage. Once you navigate away from that page, the elements no longer exists (you have a list where each element points to a no-longer-existing web element). Instead of referring to the list of elements, you should use a list of URL strings:

list_of_links = []links = driver.find_elements_by_partial_link_text("VS")for link in links:    list_of_links.append(link.get_attribute("href"))for string_link in list_of_links:    try:        driver.get(string_link)    except StaleElementReferenceException:       pass