I am trying to select an item from a drop down menu in the HTML below.
<select class="select" name="expiration">
<option value="N" selected="selected">Never</option>
<option value="10M">10 Minutes</option>
<option value="1H">1 Hour</option>
<option value="1D">1 Day</option>
<option value="1W">1 Week</option>
<option value="2W">2 Weeks</option>
<option value="1M">1 Month</option>
Here is my current code. I don't receive any errors, just the item doesn't get selected.
# 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
$expiration = $ie.Document.getElementsByClassName('expiration')what is the value of$expirationafter this line ? Theclasson yourselectelement isselectnotexpiration. Moreover I don't think you can select an element in a list on a webpage with PO'sSelect, it will only filter what you pipe to it but not act on the webpage