使用vbscript在下拉列表中选择一个值

时间:2018-11-01 22:19:36

标签: vbscript

我正在尝试从“现在的服务”表单的下拉列表中选择一个值。我能够检索下拉列表中的值。但是我无法选择一个值。这是我的代码。

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
Set IE = WScript.CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.FullScreen = true
IE.Navigate URL  

WScript.Sleep 15000

Set obj = ie.document.getElementById("sp_formfield_IO:7bb004650f30da00471ce498b1050e97")
For Each opt In obj.Options
If opt.Value = "Data Request" then
    opt.Selected = True
    obj.FireEvent ("onchange")
    Exit For
Else
    opt.Selected = False
End If
Next

这是我的Dropbox部分的HTML代码

<select name="IO:7bb004650f30da00471ce498b1050e97" tabindex="-1" title="{{field.label}}{{::field.hint}}" class="ng-pristine ng-untouched ng-valid ng-scope ng-isolate-scope select2-offscreen ng-not-empty" id="sp_formfield_IO:7bb004650f30da00471ce498b1050e97" aria-invalid="false" ng-init="setPriceLabelForChoice(field)" options="field.choices" ng-model="fieldValue" ng-disabled="field.isReadonly()" ng-switch-when="choice" glide-form="getGlideForm()" field="field" ng-model-options="{getterSetter: true}" sn-select-width="auto" ng-options="c.value as getLabel(c) for c in field.choices track by getVal(c.value)"><option value=" " label="Please Select">Please Select</option><option value="Data Request" label="Data Request">Data Request</option><option value="Initial Build" label="Initial Build">Initial Build</option><option value="Defect Fix" label="Defect Fix">Defect Fix</option><option value="Schema Changes" label="Schema Changes">Schema Changes</option><option value="Other" label="Other">Other</option></select>

如何解决此问题,以便从下拉列表中选择一个值?

0 个答案:

没有答案