title: Python: element is not attached to the page document
body: <p>I keep getting this error, and while I fixed it for another element, I can't fix it for this one. I think it's because for the other element I could find_by_ID, whereas this element does not have an ID.</p>
  
  <pre><code>while True:
  try:
       driver.find_element_by_name('commit')
       break
  except (NoSuchElementException, StaleElementReferenceException):
       time.sleep(1)
       wait=WebDriverWait(driver, 10,ignored_exceptions=ignored_exceptions).until(EC.presence_of_element_located((By.NAME, 'commit')))
  driver.find_element_by_css_selector('input.button').click()
  </code></pre>
  
  <p>Error: </p>
  
  <blockquote>
    <p>selenium.common.exceptions.StaleElementReferenceException: Message:
    stale element reference: element is not attached to the page document</p>
  </blockquote>
  
  <p>Reference page: <a href="http://www.supremenewyork.com/shop/shirts/go8jt7kse/f74y2ihpz" rel="nofollow noreferrer">http://www.supremenewyork.com/shop/shirts/go8jt7kse/f74y2ihpz</a></p>
  
  <p>Specific HTML element:</p>
  
  <pre><code>&lt;input type="submit" name="commit" value="add to cart" class="button" /&gt;
  </code></pre>