title: Selenium WebDriver and DropDown Boxes
body: <p>If I want to select an option of a dropdown box, there are several ways to do that. I always used:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>driver.findElement(By.id("selection")).sendKeys("Germany");
  </code></pre>
  
  <p>But that didn't work every time. Sometimes another option was selected. So I googled a little bit and found this piece of code which works every time:</p>
  
  <pre class="lang-java prettyprint-override"><code>WebElement select = driver.findElement(By.id("selection"));
      List&lt;WebElement&gt; options = select.findElements(By.tagName("option"));
      for (WebElement option : options) {
          if("Germany".equals(option.getText()))
              option.click();
      }
  </code></pre>
  
  <p>But that works really really slow. If I have a long list with many items in it, it really takes too much time. So my question is, is there a solution which works every time and is fast?</p>