title: PowerShell Internet Explorer Com Object Select Class Drop Down Menu Item
body: <p>I am trying to select an item from a drop down menu in the HTML below. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select class="select" name="expiration"&gt;
  &lt;option value="N" selected="selected"&gt;Never&lt;/option&gt;
  &lt;option value="10M"&gt;10 Minutes&lt;/option&gt;
  &lt;option value="1H"&gt;1 Hour&lt;/option&gt;
  &lt;option value="1D"&gt;1 Day&lt;/option&gt;
  &lt;option value="1W"&gt;1 Week&lt;/option&gt;
  &lt;option value="2W"&gt;2 Weeks&lt;/option&gt;
  &lt;option value="1M"&gt;1 Month&lt;/option&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my current code. I don't receive any errors, just the item doesn't get selected.</p>
  
  <pre><code># Code to select menu item
  $ie = New-Object -comobject InternetExplorer.Application 
  $ie.visible = $False
  
  # navigate to URL
  $ie.navigate('http://URL')
  while ($ie.Busy -eq $true) { Start-Sleep -Milliseconds 1000; }
  
  $expiration = $ie.Document.getElementsByClassName('expiration')
  $expiration.outerText |Select-Object -Index 2
  $ie.Document.getElementById('submit').Click()
  Start-Sleep -Milliseconds 1000
  $result = $ie.LocationURL
  </code></pre>