1

I have a web page which contains a download link. If I click on the link, download dialog window will be launched and asking save or cancel.

If I click on Save, file will get downloaded, it will be closed if I click on Cancel button.

But, Selenium IDE is capturing any actions performed in the dialog window.

Please tell how to handle this situation using Selenium IDE.

Thanks in advance.

Karunagara
  • 389
  • 1
  • 8
  • 30

2 Answers2

0

Unfortunately save as dialogs cannot be interacted with via javascript so Selenium IDE can't manipulate them.

If you want to click on a link and download a file, you can set up Firefox to automatically save files (without dialog - http://kb.mozillazine.org/File_types_and_download_actions). At lease with this method you can save the file when running localy.

The limitation of this will be that if you wanted to export the selenese and run it on an external testing solution (Saucelabs or Testingbot) it is unlikely that this approach will work.

AndrewD
  • 451
  • 3
  • 13
0

You can also modify the firefox profile in the setUp method of your test.

profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/msword,application/csv,text/csv,application/rtf,application/xml,text/xml,application/octet-stream,application/vnd.ms-excel,application/zip,text/txt,text/plain,application/pdf,application/x-pdf");

If you have other types of documents you want to download you should look up the MIME type of whatever document you are trying to download and adding it to the comma delimited list.

Aaron Levenstein
  • 385
  • 2
  • 12