I am trying to attach Watin to an existing instance of Internet Explorer 9. The trouble is no matter what I try it seems to just timeout. The code I am using is:
Settings.AttachToBrowserTimeOut = 240;
Settings.WaitUntilExistsTimeOut = 240;
Settings.WaitForCompleteTimeOut = 240;
Browser.AttachTo<IE>(Find.ByTitle("Google"), 240);
This code is what is in the Watin guide here minus the timeout adjustments I have tried. I have also tried setting the code to run x86 not any cpu but still not working. Any ideas what I am doing wrong.
The method you write in is missing the single threaded
ApartmentState. The easiest way to fix this is to add[STAThread]above the method where you’re trying to use that code.For example this:
acts like you described. When you uncomment the
[STAThread]it works as intented.