问题
Any tricks in getting WatiN to run on Win7/IE8?
My code:
browser = new IE();
browser.GoTo("http://testserver");
browser.TextField(Find.ByName("txtUser")).TypeText("tyndall");
The third line never really runs and I get an error back:
System.Runtime.InteropServices.COMException : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
The second line seems to run. IE8 appears and is navigated to the correct URL.
回答1:
Reboot the machine
There are windows updates getting in the way of instantiating new COM objects.
See my answer on this question for more details:
WatiN, NUnit and CruiseControl.NET-- Error message 800704a6
回答2:
Running Visual Studio as Administrator solved this problem for me. (Visual Studio 2008 with WatiN 2.0.20).
回答3:
The other alternative to avoid running Visual Studio or NUnit as an admin would be to disable UAC at a machine level, which shouldn't be a security issue if you are running with least privileges (which you should be).
回答4:
in win 7 sp1
reduce security level in user configuration managment
回答5:
I started to get the same exceptions: "System.Runtime.InteropServices.COMException : The RPC server is unavailable." after closing IE while the Developer Tools pane was open.
Hit F12 to close the developer pane and make sure it is closed whenever you close IE (IE remembers the state when starting).
来源:https://stackoverflow.com/questions/2464877/asp-net-unit-testing-watin-and-windows-7-internet-explorer-8