I'm having a problem running a protractor test. Test has to download a file which is facing a popup in firefox as shown below:
Can someone please help me how to avoid this on firefox?
I'm using protractor: 5.4.1, NodeJS: 8.11.2
My conf.js Capabilities: capabilities: { 'browserName': 'firefox', 'marionette' : true, 'shardTestFiles': true, 'maxInstances': 1, "browser.helperApps.neverAsk.saveToDisk": "application/zip" },
Note: Chrome doesn't have this so it's working fine there.
Regards, Naresh Surya
you can try this:
export let config: Config = {
seleniumAddress: '...',
capabilities: {
'browserName': 'firefox',
'moz:firefoxOptions': {
prefs: {
'browser.download.folderList' : 2,
'browser.download.dir' : downloadsPath,
'services.sync.prefs.sync.browser.download.useDownloadDir' : true,
'browser.download.useDownloadDir' : true,
'browser.download.manager.closeWhenDone':true,
'browser.download.manager.showWhenStarting': false,
'browser.helperApps.alwaysAsk.force':false,
'browser.download.manager.showAlertOnComplete':false,
'browser.download.manager.useWindow':false,
'browser.helperApps.neverAsk.saveToDisk': 'application/pdf,application/csv,text/plain,application/vnd.csv',
'pdfjs.disabled': true
},
}
...
Being dowloadsPath your variable with the path where you want it to save.
If it does not work for you, you can always try with many other types like:
application/xml,text/plain,text/comma-separated-values,application/excel,application/octet-stream,application/xlsx,application/xls,aplication/vnd.ms-excel,application/vnd.ms-excel.addin.macroenabled.12,application/vnd.ms-excel.sheet.binary.macroenabled.12,application/vnd.ms-excel.template.macroenabled.12,application/vnd.ms-excel.sheet.macroenabled.12,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,text/xml,application/csv,application/pdf,application/octet-stream,application/x-winzip,,application/x-gzip
If you have a way to prevent firefox opening the file .xml or csv, just let me know. So far, mine is only working for pdf.
Here you have more info:http://kb.mozillazine.org/Firefox_: FAQs :_About:config_Entries
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.