Changing default download directory in Chrome Webdriver
I do not have the test setup but passing below as desired_capabilities
or extra_capabilities
to the constructor should work fine.
'download.default_directory', 'C:\New_Folder'
Snippet (untested):
my $driver = Selenium::Remote::Driver->new( 'browser_name' =>'chrome', 'extra_capabilities' => { 'chromeOptions' => { 'prefs' => { 'download.default_directory' => 'C:\New_Folder' } } });
Edit: Difference between Selenium::Chrome
and Selenium::Remote::Driver
Selenium::Chrome allows you to use the ChromeDriver without needing the JRE or a selenium server running. If the ChromeDriver binary is not found, it falls back to the default Selenium::Remote::Driver.
I had troubles understanding the difference mentioned between Selenium::Chrome
and Selenium::Remote::Driver
. Here's what I got to work:
my $driver = Selenium::Chrome->new( extra_capabilities => { 'goog:chromeOptions' => { prefs => { 'download.default_directory' => '/tmp' }, args => [ 'window-size=1950,500' ] } });