Reputation: 646
I have a Node.js file that looks like this:
var webdriver = require('selenium-webdriver');
var chrome = require('selenium-webdriver/chrome');
var driver = new webdriver.Builder()
.withCapabilities(webdriver.Capabilities.chrome())
.setChromeOptions(new chrome.Options().setUserPreferences(
{ "download.default_directory": dir.join(__dirname, 'extensions')}
))
.build();
driver.get("[URL to Download]")
When I run this, it downloads the item I want, but chrome warns that the file might not be safe:
Is there Any way to automatically accept the download or click continue?
Upvotes: 1
Views: 1262
Reputation: 8414
There is a download.prompt_for_download
preference available for Chrome. Try adding it
var driver = new webdriver.Builder()
.withCapabilities(webdriver.Capabilities.chrome())
.setChromeOptions(new chrome.Options().setUserPreferences(
{ "download.default_directory": dir.join(__dirname, 'extensions'),
"download.prompt_for_download": false
}
))
.build();
Upvotes: 2