I'm trying to automate a website, and I have the following piece of code to change the value of a dropdown (select):
private bool ChangeElementSelection(mshtml.IHTMLDocument3 document, string id, string value)
{
var el = document.getElementById(id);
if (el != null)
{
log.Write("Setting HTML element " + id + " value to " + value + " (by ID)");
el.setAttribute("value", value);
var el3 = (el as IHTMLElement3);
el3.FireEvent("onchange");
return true;
}
log.Write("Could not find HTML element " + id + " (by ID)");
return false;
}
The website I am visiting uses JQuery to catch the "change" event for the select element. It does not expect any parameters. Yet the script is not triggered. Why ?