title: Rselenium - How to scrape all drop down list option values
body: <p>How can all the option values from a drop down list be scraped using Rselenium?  </p>
  
  <p>Sample of page source:</p>
  
  <pre><code>&lt;select name="main$ddArea" onchange="javascript:setTimeout(&amp;#39;__doPostBack(\&amp;#39;main$ddArea\&amp;#39;,\&amp;#39;\&amp;#39;)&amp;#39;, 0)" id="main_ddArea" class="groupTextBox"&gt;
  &lt;option selected="selected" value="95182"&gt;Area 1&lt;/option&gt;
  &lt;option value="95183"&gt;Area 2&lt;/option&gt;
  &lt;option value="95184"&gt;Area 3&lt;/option&gt;
  &lt;option value="95185"&gt;Area 4&lt;/option&gt;
  &lt;option value="95186"&gt;Area 4&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>The result wanted is a vector with each value as an element.  For example, values = c("95182", "95183", "95184", "95185", "95186")</p>
  
  <p>Obtaining a string of the values would also likely work as it could be split into elements, e.g., using strsplit.</p>
  
  <p>getElementAttribute() with 'value' or 'option' does not work. E.g.,</p>
  
  <pre><code>dd.areas = remDr$findElement(using='id', value="main_ddArea")
  dd.areas$getElementAttribute('option')
  </code></pre>
  
  <p>or</p>
  
  <pre><code>dd.areas$getElementAttribute('value')
  </code></pre>
  
  <p><code>getElementText()</code> finds one string of the text, e.g, "Area 1 /n Area 2 /n Area 3 /n...." .  But the text can't later be used to navigate the drop down list. In other words, when navigating the dropdown list using <code>$findelement()</code>, a value is needed to populate the drop down list; text does not work.</p>
  
  <p>The <a href="https://cran.r-project.org/web/packages/RSelenium/RSelenium.pdf" rel="nofollow">package documentation</a> does not appear to contain references to drop down lists and neither does the <a href="https://cran.r-project.org/web/packages/RSelenium/vignettes/RSelenium-basics.html#sending-text-to-elements" rel="nofollow">vignette</a>. </p>