I am trying to automate the selection from a drop down list in html via VBA.
HTML is below. I can set the index of the option and also change the value of the combobox, but neither is actually sticking and changing the value in the combobox.
I have tried:
'this return "Object Not Supported" Error.
doc.getElementById("CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST_comboboxinput").selectedIndex = 1
'The below does enter the term I want, but clicking the search button resets it to the first item in the list.
doc.getElementById("CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST_comboboxinput").Value = "Quote Number"
'this sets the index but does not update the actual combobox
doc.getElementById("CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST").selectedIndex = 2
'and fire events doesn't help either
doc.getElementById("CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST").fireEvent "onChange" (or "onClick")
<span class="input-large dynamic-input" id="CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria" data-bind="bizEntityDynamic: DynamicStore.PolSearchCriteria" data-sid="CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_46" data-origin="bizEntityDynamic">
<select class="input-large dynamic-input combobox" id="CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST" style="display: none;" data-bind="bizEntityList: DynamicStore.PolSearchCriteria" data-sid="CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST_47" data-origin="bizEntityDynamic" data-origid="CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria" data-origclass="input-large dynamic-input">
<option value=""></option>
<option value="1">Name of Insured</option>
<option value="2">Quote Number</option>
<option value="4">Account Number</option>
<option value="8">Policy Number</option>
<option value="8388608">Policy Prefix / Number</option>
<option value="16">User Id</option>
<option value="4194304">Underwriter Id</option>
<option value="32">Sys. Assign Number</option>
<option value="524288">Prev Sys. Assign Number</option>
</select>
<span class="custom-combobox-large" id="CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST_comboboxwrapper">
<span class="ui-helper-hidden-accessible" role="status" aria-live="polite"></span>
<input title="Select search criteria" class="custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left ui-autocomplete-input f1HelpTarget" id="CoPolicyCreateSelectHTML_DynamicStore_PolSearchCriteria_LST_comboboxinput" type="text" data-cbox="closed" autocomplete="off" data-dropdown="true" data-origval="Name of Insured">
<a tabindex="-1" title="" class="ui-button ui-widget ui-state-default ui-button-icon-only custom-combobox-toggle ui-corner-right" role="button" aria-disabled="false">
<span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-s"></span>
<span class="ui-button-text"></span></a>
</span>
</span>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…