Web browser navigate complete - c# desktop application


I am pretty sure you have used web browser tool when you are developing C# desktop applications. When you interact with web browser control of C# you will have to face a problem how to catch web browser navigated event. If you need to catch it’s document_completed event for that. But some pages that above mentioned method is firing many times. Therefore it is hard use for single time and better use below lines after the

webbrowser.navigate(“your web site address”);

After that you can use below lines and then the system will be wait until the web browser loads the web page 100%.

   while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
            {
                Application.DoEvents();
            } 

Now you can catch any element of the web browser loaded web page.

Comments

Popular Posts