title: Selenium: Let findElements wait for visible element although invisible element exists
body: <p>We want to send some keys to an element identified by name. In the application there might be multiple elements with the same name but in that case just one will be visible. To do that we have a code snippet like that (simplistic code, no production code):</p>
  
  <pre><code>List&lt;WebElement&gt; list = driver.findElements(By.xpath("//[@name='title']"));
  for (WebElement elem : list) {
      try {
           elem.sendKeys(value);
           break;
      } catch (Exception e) {
           // ignore
      }
  }
  </code></pre>
  
  <p>If the title element is not yet there we wait for it to appear using implicit wait. So usually this will work fine. Anyway we sometimes have the case that there are already elements with that name (but are hidden) and the correct one will just be created by async code. But in this case the code will not work. As the <code>findElements()</code> will return immediately (no implicit wait) just returning invisible elements. In that case <code>sendKeys()</code> will wait for the element to become visible but this never happens (ignoring new elements created after <code>findElements</code>) and so it fails after the implicit wait timeout.</p>
  
  <p>Basically we need the possibility to tell <code>findElements()</code> that we just want to have visible elements. If there are no visible elements Selenium should wait for the implicit wait duration. Is this possible?</p>