title: Selenium Webdriver Java: how to get the visible text in dropdown menu from the value?
body: <p>I am working with the following dropdown menu: </p>
  
  <pre><code>&lt;select id="id_time_zone" name="time_zone" onchange="validate_field($(this), [validate_required])"&gt;
      &lt;option value=""&gt;Please Select&lt;/option&gt;
      &lt;option value="1"&gt;UTC-12&lt;/option&gt;
      &lt;option value="2"&gt;UTC-11&lt;/option&gt;
      &lt;option value="3"&gt;UTC-10&lt;/option&gt;
      &lt;option value="4"&gt;UTC-9&lt;/option&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>What I am trying to do:
  I am trying to write a program that returns the current text that is selected. For example, if "UTC-12" is selected, my method would return String timezone="UTC-12."</p>
  
  <p>What I have tried so far: </p>
  
  <pre><code>@FindBy(id = "id_time_zone")
  WebElement editSubOrg_timezone;
  
  // Reads and returns field
  public String readField() {
  tmp = editSubOrg_timezone.getText();
  return tmp;  
  }
  </code></pre>
  
  <p>Does not work, getText() returns all values in dropdown</p>
  
  <pre><code>@FindBy(id = "id_time_zone")
  WebElement editSubOrg_timezone;
  
  // Reads and returns field
  public String readField() {
  tmp = editSubOrg_timezone.getAttribute("value") ;
  return tmp;  
  }
  </code></pre>
  
  <p>Does not work, getAttribute("value") returns the the value (ie 1,2,3,4), not the corresponding displayed text</p>