如何测试IE弹出窗口的内容
我正在使用 Watin 和 Nant 为我的网站创建单元测试。
我想知道如何测试弹出的 IE 窗口的内容。 当用户单击包含 target="_blank" 的链接时,该窗口就会打开,如下例所示
<p>
... receives oversight and governance from the
<a target="_blank" href="ihealth.html">iHealth Alliance</a>,
a not-for-profit organization .... </p>
这是我尝试使用的代码:
_ie = new IE(SITE_ROOT);
_ie.Link(f => f.Text == "iHealth Alliance").Click();
//here i need to enter something to check if popup window has appropriate title
//something like Assert.AreEqual("My page title to test", _ie.ChildWindows[0].Title)
如我所见,Watin 的 API 允许在一个 IE 窗口中搜索控件,但是,由于某种原因,它不会跟踪由于主窗口工作而打开的新窗口。 肯定应该有像 ChildWindows 或 PopupWindows 集合之类的东西,
你能建议我如何做到这一点吗?
谢谢你!
I'm using Watin and Nant to create unit tests for my web site.
I want to know the way how to test content of the popup IE window.
That window is opening when user clicks on the link that has target="_blank", like on the example below
<p>
... receives oversight and governance from the
<a target="_blank" href="ihealth.html">iHealth Alliance</a>,
a not-for-profit organization .... </p>
Here is the code I'm trying to use:
_ie = new IE(SITE_ROOT);
_ie.Link(f => f.Text == "iHealth Alliance").Click();
//here i need to enter something to check if popup window has appropriate title
//something like Assert.AreEqual("My page title to test", _ie.ChildWindows[0].Title)
As i can see, Watin's API allows to search for controls within one IE window, but, for some reason, it does not track for new windows that is opening as result of working primary window.
There definitely should be something like ChildWindows or PopupWindows collections
Can you suggest me the way of how i can do that?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了这个问题的解决方案
Browser.AttachTo() 允许附加到任何 IE 窗口,并且可以按十几个标准进行搜索
所以,我的代码将如下所示:
I found the solution for this thing
Browser.AttachTo() allows to attach to any IE window and it lets to search by dozen criteries
So, my code will look like: