Download location Selenium-webdriver Cucumber Chrome
The download directory can be set with the download.default_directory
preference:
require 'capybara'
require 'selenium-webdriver'
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app,
:browser => :chrome,
:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(
'chromeOptions' => {
'args' => [ "--window-size=1920,1080" ],
'prefs' => {
'download.default_directory' => File.expand_path("C:\\Download"),
'download.prompt_for_download' => false,
'plugins.plugins_disabled' => ["Chrome PDF Viewer"]
}
}
)
)
end
session = Capybara::Session.new(:chrome)