我正在尝试在启动代码后运行导航URL加载完成,但它不会。
webBrowser1.Navigate("mail.yahoo.com");
// need page load complete then go executing code.
webBrowser1.Document.GetElementById("username").SetAttribute("value", "sumon234");
webBrowser1.Document.GetElementById("passwd").SetAttribute("value", "stack234");
webBrowser1.Document.GetElementById(".save").InvokeMember("click");
webBrowser1.Navigate("mail.yahoo.com");
答案 0 :(得分:0)
试试这个:
// navigate...
webBrowser.Navigate(stringUrl);
// wait for document ready state...
while (webBrowser.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
// do what you need