Para
Para

Reputation: 2082

watin attach to manually started window keeps failing

IList<string> values = new List<string>();
var instance = Find.By("hwnd", "110CC");
    ...
if(instance != null)
{
   var ie = Browser.AttachTo<IE>(instance);

The browser instance is manually started by the tester in case this makes any difference.
This just doesn't work for me I keep getting an exception from watin saying that it can't find a window with that handle. I got the handle with Spy++.
I tried searching by window title or window url also but it also didn't work. Is there any way to do this? Thank you

Upvotes: 1

Views: 1100

Answers (1)

OCary
OCary

Reputation: 3311

The below works as expected / no errors. WatiN 2.1, IE9, Win7

Before running the code, open an IE browser and point it at cnn.com

    IE browser = Browser.AttachTo<IE>(Find.ByUrl("www.cnn.com"));
    browser.TextField("hdr-search-box").TypeText("searchy");

Upvotes: 2

Related Questions