I'm testing a web app with Selenium and I actually need to download a txt file during my test. But this seems impossible because a pop up appears asking to save the file. So, this blocks the progress of the test. Some have advised me to use Wget, but I don't know how to use this tool. Could you please help out for this?
Are you trying to test that you can successfully download this file from the site? Or does the txt file have information in it you need for your tests and you just need some way to download it within them?– Sam WoodsApr 12, 2014 at 6:29
No, I'm just trying to download the file from the web app I'm testing with Selenium. This works manually but not with Selenium because of this problem blog.codecentric.de/en/2010/07/… That's why I want to use WGet to solve my problem.– KazmanApr 14, 2014 at 11:36
The reason I ask is that using WGet won't necessarily test that the link from your website is correct. My preferred solution is to change the browser settings to do silent downloads and not have a dialog displayed.– Sam WoodsApr 14, 2014 at 15:56
Is this possible ? How can we not to have the dialog displayed ? I'm using firefox and IE– KazmanApr 15, 2014 at 8:24
Example for firefox: elementalselenium.com/tips/2-download-a-file Unfortunately, in IE, there is no way to remove the dialog completely.– Sam WoodsApr 15, 2014 at 16:28
WGet is a command-line tool used to download files. Here's a good tutorial on how it works; you'll need to call out to the command line from inside your test and execute wGet, then check the file it downloaded. How you do this differs depending on your setup (Java vs C#, Windows vs Linux, et cetera).
Basically you want to execute the command
wget http:\\www.yourwebsitehere.com\file\todownload.txt -O c:\directory\tosave\file.txt using the shell.
You could also do two commands:
cd c:\directory\tosave\file.txt followed by
Thank you Yamikuronue for your return. This is nice ! And sorry for the late ;)– KazmanApr 14, 2014 at 12:26
@Kazman If I was helpful, please click the little "up" arrow next to my post :) And if that solved your problem, go ahead and click the little checkmark to accept the answer Apr 14, 2014 at 14:02