First of all I found that WinClicker has some defects, as any non
stable code, but easy to fix. If you have strange things happening
check WinClicker.
In the other hand I suggest you to have a win32 call in charge of
close any popup. The following code close any window with the given
popupTitle using WinClicker, Ruby, and standard win32 calls like
PostMessage (
http://msdn2.microsoft.com/en-us/library/ms644944.aspx):
wc = WinClicker.new
popupTitle = /Windows Internet Explorer/
hwnd = wc.getWindowHandle(popupTitle)
user32 = DL.dlopen("user32")
postMessage = user32['PostMessage', 'ILILL']
postMessage.call(hwnd, 0x0010, 0, 0)
An improvement would be getting all IE children of type popup and then
close them using a win32 call like EnumChildWindows.