Can't stop Protractor from displaying file dow

2019-02-18 07:09发布

问题:

Problem

I'm testing downloading a file, but when I trigger the download, the "Save as..." prompt appears. I saw a solution in this SO question but it doesn't seem to work for me.

Config

My protractor config file looks like this (coffeescript):

exports.config =
  capabilities:
    browserName: "chrome"
    shardTestFiles: true
    maxInstances: 2
    chromeOptions:
      args: ['--no-sandbox', '--test-type=browser']
      prefs:
        download:
          prompt_for_download: false
          default_directory: '/'
          default_content_settings:
            popups: 0

More

On chromeOptions.pref webdriver docs states:

See the 'Preferences' file in Chrome's user data directory for examples.

I can't actually see default_directory in my own Chrome preferences file.

"download": {
  "directory_upgrade": true,
  "prompt_for_download": false
},

System

  • Protractor: Version 1.5.0 (pretty new)
  • Node: 0.10.28, 0.11.8 and 0.11.14

回答1:

Provide an absolute path to an existing directory in default_directory chrome preference.