Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't stop Protractor from displaying file download prompt

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
like image 213
Ashley Coolman Avatar asked Jan 05 '15 18:01

Ashley Coolman


Video Answer


2 Answers

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

like image 191
alecxe Avatar answered Sep 20 '22 05:09

alecxe


For me, the Save As prompt was appearing when I mentioned a slash at last in the path for example: A:\Proj\Downloads\ & didn't see any prompt when mentioned without a slash at the end of the path i.e A:\Proj\Downloads

like image 37
alvice8 Avatar answered Sep 20 '22 05:09

alvice8