title: Python Selenium - StaleElementReferenceException
body: <p>I'm trying to scrape a website called iens with different webpages. Right now I'm able to scrape one page successfully.</p>
  
  <p>My code thus far:</p>
  
  <pre><code>chrome_path = '/Users/username/Downloads/chromedriver'
  driver = webdriver.Chrome(chrome_path)
  url = 'https://www.iens.nl/restaurant'
  pageExt = '#page='
  restaurantList = []
  cityList = ['utrecht']
  
  def scrape(pageNumber):
      driver.get(url + '+' + cityList[0] + pageExt + str(pageNumber))
      items = driver.find_elements_by_class_name("resultItem-
      information")
      for item in items:
           restaurantList.append(item.text)
      return restaurantList
  
  print scrape(14)
  </code></pre>
  
  <p>This gives me the results I need. However when I want to scrape more than one page like this:</p>
  
  <pre><code>print scrape(12)
  print scrape(14)
  </code></pre>
  
  <p>I get the correct results for the data on webpage 12, but instead of getting the results for webpage 14 as well, I get the following error message:</p>
  
  <pre><code>selenium.common.exceptions.StaleElementReferenceException: Message: 
  stale element reference: element is not attached to the page document
  </code></pre>
  
  <p>The page is called <a href="https://www.iens.nl/restaurant+utrecht" rel="nofollow noreferrer">https://www.iens.nl/restaurant+utrecht</a></p>
  
  <p>Could you help me out?</p>
  
  <p>Thanks in advance!</p>