-->

WatiN BrowserNotFoundException after upgrading to

2019-08-13 21:37发布

问题:

I just upgraded my x64 Windows 7 machine to IE9 and now WatiN is throwing a BrowserNotFoundException when I do something like:

IE ie = new IE(true);
ie.GoTo("http://google.com");

I am using WatiN 2.1 and the latest code from SourceForge. The exact version of IE9 I'm running is 9.0.5. The browser window actually launches to "about:blank" but WatiN fails to find the newly launched browser. It appears WatiN finds the newly launched browser by comparing the main window handle of the launched iexplore.exe process to the main window handle of the browsers it finds using the native COM methods.

Is there any special setup I need to do with IE 9 to make it work with WatiN? I've tried changing WatiN to launch without add-ons and that didn't work either. Any ideas are greatly appreciated.

回答1:

I had a similar issue a little while back and was able to solve it by changing my IE9 settings. The main things I find that tend to break WatiN are compatibility mode and protected mode. Turn these off. For Protected mode you have to turn it off for each security level. Not sure if this is the issue but thought I should mention it just in case!



回答2:

I've got no idea since I've got the same configuration and everything is working ok here, but what happens when you put a System.Threading.Thread.Sleep(5000); between the two lines? Is there any difference if you run the test through NUnit? What happens when you start the browser with IE ie = new IE("http://google.com"); Can you load the example from here and try to run the included example - \example\watin?