Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting chromedriver preferences on protractor tests

Trying to find a solution to download files during my tests, i found this question that lead me to preferences file in chrome folder.

Apparently, there are no info about shutting the prompt for download or/and setting a default folder. Does anyone knows how i can do this?

Here's what i tried:

capabilities: {
        'browserName': 'chrome',
        'chromeOptions': {

            prefs: {
                'downloads': {
                    'prompt_for_download': false,
                    'default_directory': '/downloads/'
                }
            }
        }
    },
like image 715
andrepm Avatar asked Jan 13 '15 12:01

andrepm


1 Answers

You are doing it correctly, except you need to:

  • specify an absolute path to the "downloads" directory
  • add directory_upgrade option

Example:

capabilities: {
        'browserName': 'chrome',
        'chromeOptions': {

            prefs: {
                download: {
                    'prompt_for_download': false,
                    'directory_upgrade': true,
                    'default_directory': '/absolute/path/here'
                }
            }
        }
    },

See also: Can't stop Protractor from displaying file download prompt

like image 187
alecxe Avatar answered Nov 05 '22 09:11

alecxe