我正在尝试自动化网站,我有以下代码来更改下拉列表的值(选择):
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;
}
我访问的网站使用JQuery来捕获select元素的“change”事件。它不期望任何参数。然而,脚本没有被触发。为什么?