webBrowser控件无法自动跳转url,快急死了
自动登录程序,显示已经跳转到了登录后的页面,但是输出当前url还是index.php,而不是mainFrame.php,网上找了很多资料都无法解决啊private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if ((e.Url != webBrowser1.Url ) ||( webBrowser1.ReadyState != )) return;
if (webBrowser1.Url.ToString() == "http://192.168.1.8/index.php")
{
webBrowser1.Document.GetElementById("company").SetAttribute("selectedIndex", "2");
webBrowser1.Document.GetElementById("name").InnerText = "陈有福";
webBrowser1.Document.GetElementById("password").InnerText = "123456";
webBrowser1.Document.GetElementById("memusername").InvokeMember("click");
HtmlElementCollection inputs = webBrowser1.Document.GetElementsByTagName("input");
foreach (HtmlElement obj in inputs) {
if((obj.GetAttribute("src") != null) && (obj.GetAttribute("src").EndsWith("login.jpg"))){
obj.InvokeMember("click");
break;
}
}
Console.WriteLine( webBrowser1.Url);
}
跪求高人解决!!!