c# webBrowser加载完毕判断 加载完毕事件

 if (webBrowser1.ReadyState == WebBrowserReadyState.Complete && webBrowser1.IsBusy == false)
            {
                //panelEx1.Text = "页面加载完成";
                timer1.Enabled = false;
            }

 

加载完毕事件

this.webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);

void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            Trace.WriteLine(e.Url);
            currentUrl=e.Url.ToString();
            if (currentUrl == "https://dynamic.12306.cn/otsweb/")
            {
                this.webBrowser1.Navigate("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init", "main");
            }
           
        }

你可能感兴趣的:(C#)