I'd like to download a file from a page using Watir Webdriver. I need to be able to set the download location to a directory I define. I found this page, but the code there doesn't work:
profile = Selenium::WebDriver::Chrome::Profile.new
profile['download.prompt_for_download'] = false
profile['download.default_directory'] = download_directory
b = Watir::Browser.new :chrome, :profile => profile
(where download_directory is just my desktop) gives this:
Selenium::WebDriver::Error::UnknownError: unknown error: cannot parse capability: chromeOptions
from unknown error: unrecognized chrome option: profile
(Driver info: chromedriver=2.19.346063 (38b35413bd4a486d436a9749e090454bc9ff6708),platform=Mac OS X 10.11.0 x86_64)
from /Users/myusername/.rvm/gems/ruby-1.9.3-p551/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/response.rb:70:in `assert_ok'
I'm guessing that code was for an old version of Watir. How can I set Chrome's download location through Watir?