使用webbrowser类访问web,当登陆时,我故意输错密码,弹出密码错误提示框,如何去掉?使得程序流程不会因此中断,也不会一直出现该对话框.
private void webBrowser_Navigated(object sender, System.Windows.Forms.WebBrowserNavigatedEventArgs e)
{
//IHTMLWindow2 win = (IHTMLWindow2)webBrowser.Document.Window.DomWindow;
IHTMLDocument2 dc = (IHTMLDocument2)webBrowser.Document.DomDocument;
IHTMLWindow2 win = dc.parentWindow;
//string s = "window.alert = null;\r\nwindow.confirm = null;\r\nwindow.open = null;\r\nwindow.showModalDialog = null;";
//win.execScript(s, "javascript");
//win.execScript("window.alert = null;window.confirm = null;window.open = null;window.showModalDialog = null;", "javascript");
//doc.parentWindow.execScript("function alert(str){return ''}", "javascript");
}
这些是我在网上得到的,但起不到作用,请高手指点!!!急
private void webBrowser_Navigated(object sender, System.Windows.Forms.WebBrowserNavigatedEventArgs e)
{
//IHTMLWindow2 win = (IHTMLWindow2)webBrowser.Document.Window.DomWindow;
IHTMLDocument2 dc = (IHTMLDocument2)webBrowser.Document.DomDocument;
IHTMLWindow2 win = dc.parentWindow;
//string s = "window.alert = null;\r\nwindow.confirm = null;\r\nwindow.open = null;\r\nwindow.showModalDialog = null;";
//win.execScript(s, "javascript");
//win.execScript("window.alert = null;window.confirm = null;window.open = null;window.showModalDialog = null;", "javascript");
//doc.parentWindow.execScript("function alert(str){return ''}", "javascript");
}
这些是我在网上得到的,但起不到作用,请高手指点!!!急
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货