title: Selenium: findElements by class xpath, before a specific element
body: <p>I have a page with a layout like this:</p>
  
  <pre><code>&lt;div class="cool nice"&gt;...&lt;/div&gt;  //1
  &lt;div class="cool nice"&gt;...&lt;/div&gt;  //2
  &lt;div class="cool nice"&gt;...&lt;/div&gt;  //3
  &lt;div class="cool nice"&gt;...&lt;/div&gt;  //4
  &lt;div class="separator element"&gt;...&lt;/div&gt;
  &lt;div class="cool nice"&gt;...&lt;/div&gt;  //5
  &lt;div class="cool nice"&gt;...&lt;/div&gt;  //6
  </code></pre>
  
  <p>I can get all elements with <code>class="cool nice"</code> like this:</p>
  
  <pre><code>List&lt;WebElement&gt; elements=driver.findElements(By.xpath("//*[@class='cool nice']"));
  </code></pre>
  
  <p>However, I'd like to exclude elements that follow the element with <code>class="separator element</code>. What is the best way to do that?</p>