1

Using the following configuration, files are always saved in the download folder instead of the folder set for default_directory.

'capabilities': {
    'browserName': 'chrome',
    'chromeOptions': {
        'prefs': {
            'download': {
                'prompt_for_download': false,
                'directory_upgrade': true,
                'default_directory': 'src/test/javascript/e2e/downloads'
            }
        }
    }
}

2 Answers 2

1

The ChromeDriver documentation states "Relative paths do not always work. For best result, use full path instead.". Explanation why it's not always working is lacking though. Using an absolute path should fix the issue. Detailed information can be found in the links below.

ChromeDriver documentation
https://chromedriver.chromium.org/capabilities

Answer on Stack Overflow
https://stackoverflow.com/questions/27922587/setting-chromedriver-preferences-on-protractor-tests

1

Your code is working fine , which protractor version are you using. Try using full path as mentioned in other answer and also try replacing CHromeoptions with googchromeOptions if first is nt working (new protractor version everything should work fine with justt chromeoption):

https://github.com/SeleniumHQ/selenium/issues/5292

'capabilities': {
    'browserName': 'chrome',
    'goog:chromeOptions': {
        'prefs': {
            'download': {
                'prompt_for_download': false,
                'directory_upgrade': true,
                'default_directory': 'D:\\MyProjects\\protractor\\newproj\\New folder'
            }
        }
    }
},

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.