Problem collecting links from a website

Dear, Good Morning! I am writing a program in Python to collect the links of a website. The part of the code to which the links are collected is:

links = driver.find_elements_by_xpath('//*[@href]')
for link in links:
    print(link.get_attribute('href'))
time.sleep(1)

Tested on some sites and ran good. The problem is when I use in Ifood. It collects some links and then returns several errors. I'm pretty new to programming, so I don't know what these errors mean and how I can work around it. If anyone can help me, I would be very grateful! Value=)

What the code returns:

https://d1jgln4w9al398.cloudfront.net/imagens/ce/wl/www.ifood.com.br/favicon.ico
https://d1jgln4w9al398.cloudfront.net/site/2.1.238-20181023.22/css/main.css
https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800
https://www.ifood.com.br/

Traceback (most recent call last):
  File "C:\Users\jorda\Desktop\Python - Projetos\digitar ifood.py", line 32, in <module>
    print(link.get_attribute('href'))
  File "C:\Users\jorda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 143, in get_attribute
    resp = self._execute(Command.GET_ELEMENT_ATTRIBUTE, {'name': name})
  File "C:\Users\jorda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\jorda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\jorda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: chrome=70.0.3538.77)
  (Driver info: chromedriver=2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5),platform=Windows NT 10.0.17134 x86_64)
Author: Victor Stafusa, 2018-10-31