Do you think we can solve “file download pop-up handling” problem easily in automation jargon?
Did you try different methods? How? what ?
I am using selenium and PERL for functional tests automation and I wrote AutoIT script to handle file download events.
Perl process for AutoIT script waits for File download windows and when it appears it clicks on particular button to save the file at predefined or default folder. This is three-steps process – 1.) Create process that waits for file download event, 2. ) Selenium action to click a link, 3.) Back-end process wakes up and clicks on button on pop-up windows.
Instead of using these three-steps process, now I am using one step process – Click on link by selenium and file gets saved at predefined location. To achieve file download in one step, you need to change your browser settings.
1. [Optional Step] Change the file download location.
- Open FF browser and go to Tools->Options. It will open Firefox properties windows.
- Click on “General” Tab and go to Downloads settings.
- [Optional ] Uncheck first option that is “Show the Downloads Windows when downloading a file.
- [Optional] Close it when all downloads are finished.
- [optional] Save files to …. Change location.
- Do not click “Always ask me where to save files” radio button.
2. [Optional] Do you want to clear browser cache automatically when you close the browser ?
- Set the option Tools->Options
- Click on Privacy Tab and select “Never Remember History” option from History part.
3. Now go to your HTTP server and download any file manually. i.e Microsoft Word file – 1.doc.
- When you click on link 1.doc, browser will pop-up with some options like “Open” or “Save”
- Select Save option.
- There is another option bellow “Save” radio button. “Do this automatically for files like this from now on.“
- Check it and click on OK button.
- File will be saved at predefined “Download” folder.
4. Now click on browser option Tools->Options
- Click on “Application” Tab
- Search for “Microsoft office word 97…” from Content Type List.
- Change Action to “Save File”. [Default option is ” Always ask”]
5. Repeat the steps 3 and 4 for all files your going to download through script in your “AUTOMATION” world.
Now verify this setting works or not.
- Remove 1.doc from download folder.
- Go to HTTP server and click on 1.doc link.
- File will be downloaded automatically. It will not ask user to click on save button.
Now do you think, you need to write AutoIT script to handle file download event?
If you find this information useful, do not forget to write your comment.