title: Stale element reference: element is not attached to the page document when trying to getText
body: <p>i've tried different ways to solve this problem. Here's the current code:</p>
  
  <pre><code>private static List&lt;String&gt; getDrillOptionAfter(WebDriver driver, String from) {
          List&lt;WebElement&gt; menus = getDrillOptionElms(driver, from);
          List&lt;String&gt; drillOptions = new ArrayList&lt;&gt;();
          for (int i = 0; i &lt; menus.size(); i++) {
              boolean staleElement = true;
              while(staleElement) {
                  try {
                      drillOptions.add(menus.get(i).getText());
                      staleElement = false;
                  } catch (StaleElementReferenceException e) {
                      drillOptions.add(menus.get(i).getText());
                      staleElement =true;
                  }
              }
              }
          return drillOptions;
      }
  </code></pre>
  
  <p>The code tries to get the text of dropdown options.
  Also, in debug mode code works perfectly sometimes.</p>