Unable to set custom download directory path when using
Selenium Webdriver 3.3.0
Watir-Webdriver 0.9.9
Firefox 52 , geckodriver 0.15
Windows 7, Ruby 2.1.9
Code looks like this.
EXPORTS_DIR = 'exports'
EXPORTS_PATH_BROWSER = File.realpath(EXPORTS_DIR)
firefox_profile = Selenium::WebDriver::Firefox::Profile.new
firefox_profile['browser.download.dir'] = EXPORTS_PATH_BROWSER
firefox_profile['browser.download.animateNotifications'] = false
firefox_profile['browser.download.panel.shown'] = false
firefox_profile['browser.download.useDownloadDir'] = true
FIREFOX_CAPS = Selenium::WebDriver::Remote::Capabilities.firefox(
firefoxOptions: {
args: ['--always-authorize-plugins'],
prefs: firefox_profile
}
)
browser = Watir::Browser.new( firefox:, desired_capabilities: FIREFOX_CAPS)
I get Dialog to save/open file, which I don't want, and file is not downloaded. so there are 2 issues
- File Dialog should not appear
- File should be downloaded to given 'exports' directory.