Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking if WebBrowser has loaded

Tags:

browser

c#

If I have

browser.Navigate("http://www.test.com");

In a method, how can I check if it has loaded the webpage from within the same method?

Thanks.

like image 283
TheGateKeeper Avatar asked Aug 26 '26 16:08

TheGateKeeper


1 Answers

To check if it's loaded wherever, do:

if(browser.ReadyState == WebBrowserReadyState.Complete) {
    // It's done!
}

However, if you're waiting for it to load, handle the DocumentCompleted event instead:

browser.DocumentCompleted += WhenItsDone;
like image 64
Ry- Avatar answered Aug 28 '26 07:08

Ry-



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!