C#-Wait for IE to load?

2019-06-02 20:59发布

问题:

I'm opening a URL in a web browser using the following code:

        Process p = new Process();
        p.StartInfo.FileName = GetDefaultBrowserPath();  //gets path to default browser from the registry
        p.StartInfo.Arguments = "htp://www.google.com";
        p.Start();

Can someone tell me how I would wait for IE to be loaded? Is this the correct way to go about this?

Thanks, Jimmy

回答1:

Just do this:

Process.Start("http://www.google.com");

It'll open it in the default browser.



回答2:

This might be what you're looking for

p.WaitForInputIdle()