Watin - how to test site with popup pages

我是研究僧i 提交于 2019-12-03 13:08:13

问题


I'm using WatiN (Web Application Testing in .Net) to do integration testing on a Dynamics CRM 4.0 website. CRM uses a lot of popup windows - eg clicking on a Contact in a list opens a new browser window with the Contact's details.

I want to test:

  • login to CRM (done)
  • go to the Contact list (done)
  • click on an Contact, thus trigger the popup (done)
  • test functionality within the Contact entity/form (can't do)

So I need to get hold of the popped up window. How?

Thanks.


回答1:


//after the click that opens the popup:    
IE iepopup_1 = IE.AttachToIE(Find.ByUrl(theUrlOfThePopup));
//operate on iepopup_1



回答2:


Syntax has changed slightly in newest version of WatiN (v2.0.20.1089), is now:

IE poppedUpBrowser = IE.AttachTo<IE>(Find.ByUrl("http://www.popped-up-site.co.uk/"));



回答3:


Maybe searching for only part of the URL would solve it. This can be done using regular expressions:

System.Text.RegularExpressions.Regex popupHiddenRegEx = new System.Text.RegularExpressions.Regex("part_Of_URL");
IE poppedUpBrowser = IE.AttachTo<IE>(Find.ByUrl(popupHiddenRegEx));


来源:https://stackoverflow.com/questions/657250/watin-how-to-test-site-with-popup-pages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!