C# 如何测试弹出IE窗口的内容

C# 如何测试弹出IE窗口的内容,c#,nunit,watin,C#,Nunit,Watin,我正在使用Watin和Nant为我的网站创建单元测试 我想知道如何测试IE弹出窗口的内容。 当用户单击带有target=“\u blank”的链接时,该窗口将打开,如下面的示例所示 <p> ... receives oversight and governance from the <a target="_blank" href="ihealth.html">iHealth Alliance</a>, a not-for-profit organizatio

我正在使用Watin和Nant为我的网站创建单元测试

我想知道如何测试IE弹出窗口的内容。 当用户单击带有target=“\u blank”的链接时,该窗口将打开,如下面的示例所示

<p>
... receives oversight and governance from the 
<a target="_blank" href="ihealth.html">iHealth Alliance</a>,
a not-for-profit organization ....  </p>
正如我所看到的,Watin的API允许在一个IE窗口中搜索控件,但由于某些原因,它不会跟踪由于主窗口工作而打开的新窗口。 肯定应该有类似于ChildWindows或PopupWindows的集合

你能告诉我怎么做吗


谢谢大家!

我找到了解决这件事的办法

Browser.AttachTo()允许附加到任何IE窗口,并允许按十几个标准进行搜索 因此,我的代码如下所示:

_ie = new IE(SITE_ROOT);
_ie.Link(f => f.Text == "iHealth Alliance").Click();

Assert.IsNotNull(Browser.AttachTo<IE>(Find.ByTitle("My page title to test")));
\u ie=新ie(站点根);
_ie.Link(f=>f.Text==“iHealth Alliance”)。单击();
Assert.IsNotNull(Browser.AttachTo(Find.ByTitle(“要测试的我的页面标题”));
_ie = new IE(SITE_ROOT);
_ie.Link(f => f.Text == "iHealth Alliance").Click();

Assert.IsNotNull(Browser.AttachTo<IE>(Find.ByTitle("My page title to test")));