Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98784

is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed

$
0
0

So im scraping links using selenium. I can print my links with my loop but I cant navigate to them because I get the following error:

selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed

from selenium import webdriver

driver = webdriver.Firefox()

driver.get("https://www.famousgraphicdesigners.org/")

links = driver.find_elements_by_xpath('//*[@id="pages-2"]/div/ul/li/a')
links_total = len(links)
print("Found", links_total, "total links.\n")

for i in links:
    # print(i.get_attribute('href')) # This works
    driver.get(i.get_attribute('href')) # This doesnt work

driver.quit()

Viewing all articles
Browse latest Browse all 98784

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>