无法阻止量角器显示文件下载提示 [英] Can't stop Protractor from displaying file download prompt

查看:19
本文介绍了无法阻止量角器显示文件下载提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试下载文件,但是当我触发下载时,会出现另存为..."提示.我在这个 SO question 中看到了一个解决方案,但它没有t 似乎对我有用.

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.

我的量角器配置文件如下所示(coffeescript):

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

更多

关于 chromeOptions.pref webdriver 文档 声明:

有关示例,请参见 Chrome 用户数据目录中的首选项"文件.

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

我在自己的 Chrome 首选项 文件中实际上看不到 default_directory.

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

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

系统

  • 量角器:1.5.0 版(相当新)
  • 节点:0.10.28、0.11.8 和 0.11.14
  • 推荐答案

    default_directory chrome 首选项中提供一个到现有目录的绝对路径.

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

    这篇关于无法阻止量角器显示文件下载提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆