Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Waiting for a WebBrowser till all requests/page loads completely.

$
0
0

Hi,

I have to write a code that wait the browser till complete loading a page. Since the code executes faster than browser loads completely. I have used below code:

bool documentLoaded = false; public void click() { wb.Navigate("http://icertis-itm.cloudapp.net/"); wb.DocumentCompleted += webBrowser1_DocumentCompleted; while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }

Mouse.click(UITestControl); } private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { documentLoaded = true; }

In my our application after user logged into it, 'Dashboard' page gets loaded where 5-6 DIV are used and on <DIV> loading images are displayed till complete report gets load.

When I check the ReadyState property, WebBrowserReadyState is set complete then also few elements/controls (contents from DIV, loading images on DIV) are loading. At this point it performs next actionseven if the page has not finished loading.

Is there any point that I can check from WebBrowser properties that the browser have completely load all element related to the page, e.g loading images, javascript event, iframe, client side controls etc.

Does anyone know how to wait until the WebBrowser is completely done loading the page before proceeding?

Appreciate your help.

Regards,

Gital

Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>