I want to verify file download using NodeJS and Webdriverio. The file to download is of PDF format. When WebDriverIO clicks on “Download” Firefox opens up the following download confirmation window:
I want Firefox to download the file automatically without showing above confirmation window, so I used the below code:
conf_firefox.js file
require('dotenv').config();
const path = require('path');
const merge = require('deepmerge');
const baseConfig = require('./wdio.conf_base');
exports.config = merge(baseConfig.config, {
services: ['selenium-standalone'],
capabilities: [
{
maxInstances: 2,
browserName: 'firefox',
'moz:firefoxOptions': {
prefs: {
'browser.download.dir': path.join(__dirname, '../test-data/tmp/download/firefox'),
'browser.helperApps.neverAsk.saveToDisk': 'application/pdf',
},
},
acceptInsecureCerts: true,
},
],
});
but still Firefox shows the same window. How can I set Firefox profile so that PDF files are downloaded automatically without showing the confirmation dialogue?
For chrome everything works correctly. Thanks!