using SHDocVw; // Create an instance of Internet Explorer InternetExplorer explorer = new InternetExplorer(); // Navigate to a website explorer.Navigate("https://www.google.com"); // Wait for the page to load while (explorer.Busy || explorer.ReadyState != tagREADYSTATE.READYSTATE_COMPLETE) { Thread.Sleep(1000); } // Close the browser window explorer.Quit();
using SHDocVw; // Get an existing instance of Internet Explorer ShellWindows shellWindows = new ShellWindows(); InternetExplorer explorer = null; foreach (InternetExplorer window in shellWindows) { if (window.LocationURL.Contains("google")) { explorer = window; break; } } // If a Google window was found, navigate to a new page if (explorer != null) { explorer.Navigate("https://www.google.com/maps"); }In this example, we use the `ShellWindows` class to get a list of all open browser windows. We then loop through the windows until we find one that contains "google" in its URL. If we find a Google window, we use its `Navigate` method to go to the Google Maps page. Package Library: This example uses the SHDocVw library, which is a part of the Microsoft Internet Controls (MSHTML) package.