Question

So basically i'm trying to find all hidden IE windows, this should be an easy task for LINQ. So i tried a simple where:

var Instances = IE.InternetExplorers().Where(x => x.Visible == false);

but when i call the InternetExplorers() it makes all the instances visible and gets no results. So i tried to a different where:

var Instances = IE.InternetExplorers().Where(x => x.Title != "");

This also makes all instances visible, but obviously gets all the open IE windows.

So is there a way to select all instances that are not visible without making them visible, or am i doing somthing wrong?

Was it helpful?

Solution

I found the answer, i looked into the watin source and found that the InternetExplorers() method just returns new IECollection(true); so i looked at the IECollection constructor and found that WatiN.Core.Native.InternetExplorer.ShellWindows2() returns all the browsers.

So in the end i did this:

var allBrowsers = new WatiN.Core.Native.InternetExplorer.ShellWindows2().Where(x => x.Visible == false);

foreach (SHDocVw.IWebBrowser2 internetExplorer in allBrowsers)
{
    //do somthing.
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top