Handle pop up window if it shows?
-
Wednesday, August 08, 2012 11:17 AMHi i recorded coded ui test for web app but sometime it works like that if somebody log in and wait for a main page could see a pop up window but not always, user number 1 can see that pop up but when will log in user 3 he could not see it. So that i will test my web app on many users(logins) i need do something like this if(pop up windows show U) do something...how can i do that?
All Replies
-
Wednesday, August 08, 2012 11:27 AM
You can handle the pop ups using the below way
Thanks and Regards -Rajendra
- Edited by RajendraC Wednesday, August 08, 2012 11:36 AM
- Proposed As Answer by elizurm Wednesday, August 08, 2012 9:06 PM
- Marked As Answer by Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator Thursday, August 16, 2012 1:58 AM
-
Wednesday, August 08, 2012 9:28 PM
Hi,
My work with CUIT mostly includes the client side of non-web applications so I was not aware of the solution suggested by Rajendra. But just in case it doesn’t work as you would like it to, I suggest handling the situation differently:
If you know exactly what popup window you expect:
- Create an instance of it including the relevant search properties.
- Set the playback settings "SearchTimeOut" property to a reasnebl time for finding that window if it appears (you don’t have to wait a hole two minutes – default timeout, to find out it does not exist).
- Ask: if (popupWin.Exists)
- Do whatever action you need to do to get rid of the popup window.
- After the "if" block, set "SearchTimeOut" back to its original value.
If you don’t know what the specific popup window might look like:
- Ask: if (!lastActiveWindow.Enabled)
- Call: Keyboad.SendKeys("{F4}", ModifierKeys.Alt) to close it or Keyboad.SendKeys("{Tab}{Enter}") if it suits you better.
- This action will automatically close the popup window and let you get on with your code.
Hope this will solve your problem.
Elizur Mach
ALM team, Sela Group.
- Marked As Answer by Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator Monday, August 27, 2012 4:50 AM
- Unmarked As Answer by MiHo_777 Thursday, December 13, 2012 10:43 AM
- Marked As Answer by MiHo_777 Thursday, December 13, 2012 10:43 AM
-
Wednesday, November 07, 2012 4:39 PM
Hello elizurm,
Could you please elaborate more on this approach or provide a code sample to help me on this. Looks like i'm looking for something similar.
Thanks,
Shraddha

