I have to automate a case in which I have to download an Excel file using Selenium IDE.I have done this in Firefox by using custom profile feature which automatically downloads file and saves it into a user-defined folder. To do the same in Internet Explorer (IE), is there anything in IE like custom profile and preferences? how do I prompt IE to automatically download a file? I am using Java for automation. Kindly help.
|
The trick to handle any dialogs is to use external tools like AutoIT to deal with the Upload dialog, download Dialog and NTLM Authentication dialogs. Please note that this solution is intended only for users ecexuting the scripts in Windows environment. Using AutoIT you can write a simple script to get hold of the Save Dialog, this script can be then converted into a executable program with command line arguments to invoke it any time from program. Following below steps should solve your issue.
save_dialog.au3 code blatantly Copied from here DISCLAIMER... I am not the author of that blog pointed in this answer:
|
||||
|
|
|
Link to my blog where I discuss this in more detail. Inconsistencies here, are you using Selenium IDE or WebDriver with Java? Assuming you are using WebDriver with Java and not Selenium IDE(as you state in your post) You can try using:
It's quite easy to use, you just need to supply the WebElement of the Image/Hyperlink that you want to download, so instead of trying to perform a click on the WebElement you would instead pass it in to the FileDownloader Object:
This is all written in Java so it's cross browser/platform compliant. |
||||
|
|
|
I generally use keyboard shortcuts with Robot class in Java in order to emulate what I would do manually. In IE 8, saving a file would be three steps:
I start with doing the same action manually for the first test case ie. save in a certain folder, cleanup the folder and click the checkbox for close this dialog once download finishes. Next, I use the following code :
|
|||
|
|
even i'm stuck with the same issue. Have you tried using Win32::GuiTest perl module? or AutoIt? If you are using IE9, you can configure downloads folder but still would need to click on Save button when prompted. You can just use a vbscript to do it too. All these would work fine only if you have the UI on screen without locking or if it is a remote machine, then you should not be disconnected. I got finally convinced to go for a download manager like "Internet Download Manager" which provides the same kind of functionality. |
|||
|
|