selenium wget download file



  • 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?



  • 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



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2