Ruby Capybara and Firefox: download file without showing dialog

I am trying to get a Capybara session to automatically save downloaded files in Firefox without showing the open / save dialog.

This is my test code:

require 'capybara/dsl'
require 'selenium-webdriver'

cb = Capybara

cb.register_driver :my_firefox_driver do |app|
  profile =
  profile[''] = "~/Downloads"
  profile[''] = 2
  profile['browser.helperApps.alwaysAsk.force'] = false
  profile[''] = false
  profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv"
  profile['csvjs.disabled'] = true, :browser => :firefox, :profile => profile)

cb.current_driver = :my_firefox_driver

# just to check that we are reaching the correct URL
cb.visit ""
# attempt a CSV download
cb.visit ""


Firefox version 30. I have tried various profile settings as well as several MIME types, to no avail.

Thanks in advance for any suggestions or solutions.


source to share

All Articles