Watin - How to Test a Pop-Up Website

I use WatiN (Web Application Testing on .Net) to conduct integration testing on the Dynamics CRM 4.0 website. CRM uses a lot of pop-ups - for example, clicking on a contact in the list opens a new browser window with contact data.

I want to test:

  • Log in to CRM (done)
  • go to your contact list (done)
  • click on a contact to pop up (done)
  • test functionality inside the Contact object / form (cannot be executed)

So I need to get a popup. How?

Thanks.

+7
automated-tests watin dynamics-crm dynamics-crm-4
source share
3 answers
//after the click that opens the popup: IE iepopup_1 = IE.AttachToIE(Find.ByUrl(theUrlOfThePopup)); //operate on iepopup_1 
+11
source share
The syntax has changed a bit in the newest version of WatiN (v2.0.20.1089), now:
 IE poppedUpBrowser = IE.AttachTo<IE>(Find.ByUrl("http://www.popped-up-site.co.uk/")); 
+9
source share

Perhaps searching only part of the URL will allow 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)); 
+2
source share

All Articles