title: How to get the selected value from a combobox using Selenium WebDriver (Selenium 2)?
body: <p>Assume I have this html code: </p>
  
  <pre><code>&lt;select id="superior" size="1" name="superior"&gt;
      &lt;option value=""&gt;&lt;/option&gt;
      &lt;option value="c.i.e.m.md.Division_1"&gt;DIVISION007&lt;/option&gt;
      &lt;option selected="selected" value="c.i.e.m.md.Division_$$_javassist_162_119"&gt;MyDivision&lt;/option&gt;
      &lt;option value="c.i.e.m.md.Division_121"&gt;MyDivision4&lt;/option&gt;
      &lt;option value="c.i.e.m.md.Division_122"&gt;MyDivision5&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>So this is a combo box with</p>
  
  <pre><code>id=superior 
  </code></pre>
  
  <p>and currently value MyDivision is selected.</p>
  
  <p>Using Selenium WebDriver I am trying to get the selected value, but no success.</p>
  
  <p>I tried:</p>
  
  <pre><code>String option = this.ebtamTester.firefox.findElement(By.id(superiorId)).getText();
  return option;
  </code></pre>
  
  <p>But this returns me all the values in the combobox.</p>
  
  <p>Help please? </p>
  
  <p>Edit:</p>
  
  <pre><code>WebElement comboBox = ebtamTester.firefox.findElement(By.id("superior"));
  SelectElement selectedValue = new SelectElement(comboBox);
  String wantedText = selectedValue.getValue();
  </code></pre>