简体   繁体   中英

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

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();
        }
    }
}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM