profile = Selenium::WebDriver::Chrome::Profile.new
download_dir = File.join(Rails.root, 'lib', 'assets')
profile['download.default_directory'] = download_dir
profile[download.prompt_for_download] = false
@b = Watir::Browser.new :chrome, :profile => profile
firefox
profile = Selenium::WebDriver::Firefox::Profile.new
download_dir = File.join(Rails.root, 'lib', 'assets')
profile['browser.download.dir'] = download_dir
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf"
@b = Watir::Browser.new. :firefox, :profile => profile
: Rails.root/lib rails, - config/application.rb:
config.autoload_paths += Dir["#{config.root}/lib/**/"]
: http://watirwebdriver.com/browser-downloads/