title: Selenium finding an element too quickly
body: <p>My program switches through stores on the Home Depot website and records prices. After the first loop is over and the price is recorded, when it loops to the beginning I have an Explicit Wait to look for the store dropdown arrow again but the problem is the explicit wait does not wait until the page reloads with the details of the next store but instead goes straight to hitting the store drop down and then the page reloads and the program errors out when it can't find the next element nested within the drop down menu.</p>
  <p><code>Visibility_of_element_located</code> clicks on the drop down before the page changes and errors out waiting for the next element.
  <code>element_to_be_clickable</code> and <code>presence_of_element_located</code> throws a <code>stale element reference: element is not attached to the page document</code></p>
  <p><code>Time.Sleep(2)</code> at the end of the loop solves this problem but I wanted a more dynamic solution instead of fixed time.</p>
  <pre><code>def store_dropdown(driver):
      store_dropdown = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, &quot;myStore&quot;)))# Find Store Dropdown Arrow (This is where is errors out)
      store_dropdown.click()
      # time.sleep(1)
      find_my_store_button = WebDriverWait(driver, 10) \
          .until(EC.element_to_be_clickable((By.XPATH, &quot;//*[@id='myStoreDropdown']/div/div[4]/a/span&quot;))) # Find my store button
      find_my_store_button.click()
  </code></pre>