Wait until page is fully loaded using InternetExplorer Object from SHDocVw in C#?

593 Views Asked by At

How can the code wait until the webpage is fully loaded using the InternetExplorer Object from SHDocVw. in C#???

thank you very much

My code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Windows.Forms;
using SHDocVw;
using mshtml;

namespace TTD_2
{
    class Program
    {
        static void Main(string[] args)
        {

            InternetExplorer webBrowser1 = new InternetExplorer();

            webBrowser1.Visible = true;

            object mVal = System.Reflection.Missing.Value;
            webBrowser1.Navigate("https://xxxxxxx.xxx", ref mVal, ref mVal, ref mVal, ref mVal);


            // rest of the code

            // Closing the Internet Explorer Window
            //webBrowser1.Quit();
        }
    }
}
1

There are 1 best solutions below

0
On

i guess you need to do something like this

        InternetExplorer webBrowser1 = new InternetExplorer();
        webBrowser1.DocumentComplete += (object disp, ref object url) =>
        {
            //your code
        };

https://msdn.microsoft.com/en-us/library/aa768329(v=vs.85).aspx