browser.helperApps.neverAsk.saveToDisk首选项不适用于firefox的量角器 [英] browser.helperApps.neverAsk.saveToDisk preference isn't working with protractor for firefox

查看:1377
本文介绍了browser.helperApps.neverAsk.saveToDisk首选项不适用于firefox的量角器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  var q = require('q'); 
var FirefoxProfile = require('firefox-profile');

var firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference(browser.download.folderList,2);
firefoxProfile.setPreference(browser.download.dir,process.cwd()+'/ e2e / downloads /');
firefoxProfile.setPreference(browser.helperApps.neverAsk.saveToDisk,application / x-executable);

文件的MIME类型是application / x-executable。添加以上所有细节后,它显示在Firefox上弹出的下载。
$ b $ p 环境:

  Ubuntu 14.04 
Firefox 44
量角器3.2.2
Selenium-webdriver 2.53
pre

解决方案

我很确定这只是指定正确的MIME类型。显然,在这种情况下设置 application / x-executable 还不够。



最可靠的方法也就是实际上手动打开firefox ,下载文件让firefox自动保存文件。然后,打开帮助 - 疑难解答信息,打开配置文件夹,打开 mimeTypes.rdf 文件,并找到自动下载的文件的MIME类型。你会有这样的事情:

$ $ p $ < RDF:Description RDF:about =urn:mimetype:handler:x-executable
NC:alwaysAsk =false
NC:useSystemDefault =true>
< / RDF:说明>

仅供参考,您可以在逗号分隔的字符串中为 browser.helperApps.neverAsk.saveToDisk 首选项。


I am using firefox-profile with below settings -

var q = require('q');
var FirefoxProfile = require('firefox-profile');

var firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("browser.download.folderList", 2);
firefoxProfile.setPreference("browser.download.dir", process.cwd() +'/e2e/downloads/');
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/x-executable");

MIME-type of file is "application/x-executable". After adding all above details, it shows download pop up on firefox.

Environment:-

Ubuntu 14.04
Firefox 44
Protractor 3.2.2
Selenium-webdriver 2.53

解决方案

I am pretty sure it is just about specifying the correct mime-type. Apparently, just setting the application/x-executable not enough in this case.

The most reliable way to do that is to actually open firefox manually, download the file asking firefox to save the file automatically. Then, open Help - Troubleshooting Information, open Profile Folder, open mimeTypes.rdf file and locate the mime-types of the automatically downloaded files. You will have there something like:

<RDF:Description RDF:about="urn:mimetype:handler:x-executable"
               NC:alwaysAsk="false"
               NC:useSystemDefault="true">
   <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:x-executable"/>
</RDF:Description> 

FYI, you can specify multiple mime-types in comma-separated string for the browser.helperApps.neverAsk.saveToDisk preference.

这篇关于browser.helperApps.neverAsk.saveToDisk首选项不适用于firefox的量角器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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