Close Modal Windows
Hey guys!
I'm trying to figure out a way to close unexpected modal prompts during playback that originate from the tested application. I'm curious if anyone has had previous experience with this kind of problem.
From what I understand, because the modal prompts originate from the tested application, TC's "unexpected window" won't work (or atleast it hasn't so far).
I'd like implement it in a try catch statement:
try{
test actions
}
catch{
closeModalWindows()
refreshApplication()
}
I have two ideas for the closeModalWindows()
1. Use Find and get all windows in the application. Loop through each window and check its "isModal" property (which is a native java property of the window). If its modal, close it.
2. I'm reading Smartbears article on testing modal windows and I'm thinking about trying their approach, but confused on how it works. https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/modal-windows.html.
Thought I'd ask before diving too far in! Seems like it would be a common problem.
Thanks in advance!