Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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 progess of the test. Some have advised me to use Wget, but I don't know how to use this tool. Could you give me some help please ? Thanks Best regards !

share|improve this question
    
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 Woods Apr 12 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. –  Kazman Apr 14 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 Woods Apr 14 at 15:56
    
Is this possible ? How can we not to have the dialog displayed ? I'm using firefox and IE –  Kazman Apr 15 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 Woods Apr 15 at 16:28

1 Answer 1

up vote 1 down vote accepted

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 wget http:\\www.yourwebsitehere.com\file\todownload.txt

share|improve this answer
    
Thank you Yamikuronue for your return. This is nice ! And sorry for the late ;) –  Kazman Apr 14 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 –  Yamikuronue Apr 14 at 14:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.