I try to complete a foreign webpage with VB.NET
<select name="standardCode" class="form-control full-width" id="standardCode">
<option value="">Please select RSS</option>
<option value="510">Part1</option>
<option value="583">Part2</option>
</select>
<script>
$("#saveAndContinueButton").on("click", function(){
saveNames();
});
$("#standardCode").on("change", function (event){
let standardCode = this.value;
cleanSelect($("#version"));
});
</script>
The “click” event can be fired by simple “ .getElementByID("saveAndContinueButton").click()”.
But the Drop Down Menu doesn’t work.
My code is able to select the item at the drop down, but the java will not be fired.
Sub Drop_Down()
Dim doc2 As IHTMLDocument2 = IEApp.Document
Dim dropdown As IHTMLElement = doc2.all.item("standardCode")
Dim dropdownItems As IHTMLElementCollection = dropdown.children
For Each element As IHTMLElement In dropdownItems
If element.innerText = "Part1" Then
element.setAttribute("selected", "selected")
Dim doc3 = DirectCast(IEApp.Document, IHTMLDocument3)
Dim doc3el = DirectCast(doc3.getElementById("standardCode"), IHTMLElement3)
doc3el.FireEvent("onchange", Nothing)
End If
Next
I have no more ideas to solve.