Handling popups in web applications was not supported by many of the automation tools.Selenium is an open source tool which is supporting this feature.
However selenium is capable to handle only the HTML popups.There are some other popups called "Windows popups" example download popups, which are related to OS.These download popups are not handled by the selenium.
We need to use a tool called "autoit" to handle this popups.
Download the autoit exe from auto it site and pass the name of the exe as an argumnet.
If u r using java call this using execute method.
if u r using perl call this using system function