title: Listing select option values with Selenium and Python
body: <p>I have the following HTML code</p>
  
  <pre><code>&lt;select name="countries" class_id="countries"&gt;
      &lt;option value="-1"&gt;--SELECT COUNTRY--&lt;/option&gt;
      &lt;option value="459"&gt;New Zealand&lt;/option&gt;
      &lt;option value="100"&gt;USA&lt;/option&gt;
      &lt;option value="300"&gt;UK&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I am trying to get a list of the option values (like 459, 100, etc, not the text) using Selenium.</p>
  
  <p>At the moment I have the following Python code</p>
  
  <pre><code>from selenium import webdriver
  
  def country_values(website_url):
      browser = webdriver.Firefox()
      browser.get(website_url)
      html_code=browser.find_elements_by_xpath("//select[@name='countries']")[0].get_attribute("innerHTML")
      return html_code
  </code></pre>
  
  <p>As you can see the code returns pure HTML, which I am parsing with HTMLParser library. Is there any way to get the option values just using Selenium? In other words, without having to parse the result from Selenium?</p>