我正在尝试以编程方式单击webexplorer中iframe表单中的按钮。按钮有点讨厌,因为它的编码不总是活跃的。该按钮的HTML是:
<input disabled="" class="submit ui-button ui-widget ui-state-default ui-corner-all ui-button-disabled ui-state-disabled" id="btnEntryAddSav" role="button" aria-disabled="true" type="submit" jQuery1418076056597="6" value="Add ->"/>
我尝试过使用invoke但没有运气
HtmlElement ADD = frame.Document.GetElementById("btnEntryAddSav");
ADD.InvokeMember("Click");
它似乎没有实际点击。我可以看到按钮突出显示,但nadda发生了。有什么想法吗?
答案 0 :(得分:0)
//in chrome
try
{
HtmlDocument doc = webBrowser1.Document;
HtmlElement submit = doc.GetElementById("btnEntryAddSav");
submit.InvokeMember("click");
}
catch { }
//in IE try to find name tag and:
try
{
HtmlElementCollection Bpic = webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement bp in Bpic) {
string name = bp.Name;
if (name == "input_name")
bp.InvokeMember("click");
}
}
catch{}