Я пытаюсь изменить раскрывающиеся значения выбора веб-страницы с помощью PowerShell, но безуспешно.
HTML-код:
<div class="col-xs-10 col-sm-9 col-md-6 col-lg-5 form-field input_controls">
<div ng-non-bindable="" class="hidden">
<input type="hidden" id="sys_original.sc_task.state" name="sys_original.sc_task.state" value="2">
</div>
<select aria-required="false" aria-labelledby="label.sc_task.state" ng-non-bindable="true" name="sc_task.state" id="sc_task.state" onchange="onChange('sc_task.state');" style="; " class="form-control ">
<option value="" role="option" disabled="">-- None --</option>
<option value="4" role="option" disabled="">Closed Incomplete</option>
<option value="-5" role="option">Pending</option>
<option value="-1" role="option" disabled="">Queued</option>
<option value="1" role="option" disabled="">Open</option>
<option value="2" selected="SELECTED" role="option">In Progress</option>
<option value="7" role="option">Cancelled</option>
<option value="3" role="option">Closed Complete</option>
</select>
</div>
Я пробовал их в PowerShell:
$IE = New-Object -ComObject 'internetExplorer.Application'
$IE.Visible= $TRUE
$StatusField = $IE.Document.IHTMLDocument3_getElementByID("sc_task.state")
$StatusField.value = '-5'
$StatusField.fireEvent("onchange")
($StatusField | where {$_.innerHTML -eq "-5"}).Selected = $true
И это дает мне следующие ошибки:
The property 'value' cannot be found on this object. Verify that the property exists and can be set.
At C:\...ps1:53 char:1
+ $StatusField.value = '-5'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression.
At C:\...ps1:54 char:1
+ $StatusField.fireEvent("onchange")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The property 'selected' cannot be found on this object. Verify that the property exists and can be set.
At C:\....ps1:55 char:1
+ ($StatusField | where {$_.innerHTML -eq "-5"}).Selected = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Пожалуйста, помогите.