2019.5.27
System environment: Windows 10 Pro 1809, Firefox 67.0
Firefox Firefox browser - a new, safe, fast | Download the latest official
Firefox with a still good, except for two things: First, Flash can not open, the second is the download pop. zip, docx these settings can be automatically saved, and the pop-up window, select the path, but some is not a file, such as rar, ipynb (Anaconda Jupyter Notebook) , can not check the " automatically after the same operation processing such files" . If this download multiple files, it will always ask you bomb a window is opened or saved It's pretty annoying.
Open the settings, settings are automatically saved in fact it was here, ZZ is not a custom file type of action. Find the Internet to find, but post time is very old, it comes mimeTypes.rdf, the current version of Firefox did not, write a new post on what format the code into those sticky useless. Take a photo card:
Browser Menu -> Help -> troubleshooting information, open is actually about: support, the browser address bar enter this can also enter.
Open this folder, there is a Firefox configuration file, about: config changes in what will be seen in the pref.js. So that mimeTypes.rdf Where is it? Simply do not!
From then think about: config think of a way in. Because the file is saved, you lose a save in, and found a surprise:
See this browser.helperApps.neverAsk.saveToDisk, the meaning is obvious, we search helper, you see other options.
可这要怎么用?上图的结果是我应经改好的,但刚遇到时默认值是空的,我没注意类型以为就填个true或false就完事了,然后毛用没有。一看pref,js,发现这项我填的true没错,但打了双引号,其他的true是没双引号的,这就明白了:这是字符串,不是布尔值。
国内网站是没戏了,根本找不到什么,国外网站上搜一搜,发现了链接[2],虽然说用Java改什么东西,但能用about:config何必搞那玩意(其实我不会Java)。看到了这一句我大概就明白了这里字符串要填什么:firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv");
显然csv是文件类型的一种,当作text,直接save to disk。我现在正下载一堆ipynb文件,但设置text/ipynb和application/ipynb似乎都不行,可能是没有匹配的程序。
在链接[3]中我找到了我的正解:
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream");
所以在about:config中我输入了application/octet-stream,这下就能直接保存ipynb文件了,没有再弹窗提示我是否要保存或打开文件。结果图上面已有。
在链接[3]中看到这样一句话:
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/xml,text/plain,text/xml,image/jpeg,text/csv");
So how to use this string becomes clear: / Before you can write text, application, image, / then write the file type, multiple file types separated by commas.
We found some interesting options in this exploration:
browser.download.forbid_open_with, this value is a Boolean value, I chose True.
This is not to browser.altClickSave 360, Sogou browser quickly save thing, but I have not tried.
Reference links:
[1]browser.helperApps.neverAsk.saveToDisk preference isn't working with protractor for firefox | 易学教程
https://www.e-learn.cn/content/wangluowenzhang/979567
[2]How to download any file and save it to the desired location using Selenium Webdriver - Stack Overflow
https://stackoverflow.com/questions/16746707/how-to-download-any-file-and-save-it-to-the-desired-location-using-selenium-webd/16765032
[3]Firefox downloading file without window · Issue #7174 · SeleniumHQ/selenium-google-code-issue-archive · GitHub
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7174