2010-10-06 127 views
1

我瀏覽的網頁瀏覽器在我的應用程序與請等待頁面加載完成 - Windows窗體應用程序

Private Sub wb_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb.DocumentCompleted 

但我需要登錄到網站

我怎麼能等待後,導航到另一個頁面第一頁完全加載然後導航到另一頁?

回答

1

使用WebBrowser文件完成的事件:

here是一個鏈接

4

嗨這段代碼的和平將幫助,因爲它爲我做的

 private void waitTillLoad() 
      { 
       WebBrowserReadyState loadStatus; 
       //wait till beginning of loading next page 
       int waittime = 100000; 
       int counter = 0; 
       while (true) 
       { 
        loadStatus = webBrowser1.ReadyState; 
        Application.DoEvents(); 

        if ((counter > waittime) || (loadStatus == WebBrowserReadyState.Uninitialized) || (loadStatus == WebBrowserReadyState.Loading) || (loadStatus == WebBrowserReadyState.Interactive)) 
        { 
         break; 
        } 
        counter++; 
       } 

       //wait till the page get loaded. 
       counter = 0; 
       while (true) 
       { 
        loadStatus = webBrowser1.ReadyState; 
        Application.DoEvents(); 

        if (loadStatus == WebBrowserReadyState.Complete) 
        { 
         break; 
        } 
        counter++; 

       } 
}