title: Selecting multiple elements with Selenium
body: <p>I'm creating List of all available elements with below Xpath.</p>
  
  <pre><code>IList&lt;IWebElement&gt; test= Driver.FindElements(By.XPath("//*[@id='middle-container']//div[@class='middle-section match-list']//div[contains(@class,'title')]//span[contains(text(),'" + Event.Trim() + "')]//..//..//..//..//div[contains(@class,'drop-down-content')]//table[contains(@class,'hidden-xs')]//tr//td[contains(@class,'bettype')]//a[@class='bet']`//span"));
  </code></pre>
  
  <p>So all the elements available in that Xpath need to be clicked. Running <code>foreach</code> loop:</p>
  
  <pre><code>foreach (var item in availableSports)
      {
          item.Click();        
      }
  }
  </code></pre>
  
  <p>My problem is let's say if test contains more than, I think, 10 elements, it is stopping the click event after around 8 to 9 clicks, and raising this error:</p>
  
  <pre><code>StaleElementReferenceException
  </code></pre>
  
  <p>So just wondering how can I write the method which will continue click until last available element without fail. </p>