Skip to content

Instantly share code, notes, and snippets.

@karthiks
Created August 25, 2012 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthiks/3467654 to your computer and use it in GitHub Desktop.
Save karthiks/3467654 to your computer and use it in GitHub Desktop.
Tweaking Firefox preference to automatically download files to custom location
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = "#{Rails.root}/tmp/webdriver-downloads"
profile['browser.download.folderList'] = 2 # implies custom location
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf"
Capybara::Selenium::Driver.new(app, :browser => :firefox ,:profile => profile)
#...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment