Here is the code on their website but I'm not understanding what to do exactly. I'm still considerably new to Ruby.
download_directory = "#{Dir.pwd}/downloads"
download_directory.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.folderList'] = 2 # custom location
profile['browser.download.dir'] = download_directory
profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv,application/pdf"
b = Watir::Browser.new :firefox, :profile => profile
I'm trying to download a current url as a .html file that I make the browser go to. Please help anyway you can, Thanks :)
This is what I do:
require 'watir-webdriver'
@browser = Watir::Browser.new :firefox
@browser.goto 'www.watir.com'
filename = 'downloads/watir.html'
open(filename, 'w') { |f| f.puts @browser.html }
make sure the 'downloads' directory exists or you will get an error