Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
Javascript : Chrome capabilities for "default download directory", "download.prompt_for_download", and "plugins.always_open_pdf_externally"

want to know how to set below capabilities of chrome in javascript. I know Java and python but want in javascript.

Javascript : Chrome capabilities

  1. "default download directory"
  2. "download.prompt_for_download"
  3. "download.directory_upgrade"
  4. "plugins.always_open_pdf_externally"

python code

options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {
"download.default_directory": "C:/Users/517/Download", #Change default directory for downloads
"download.prompt_for_download": False, #To auto download the file
"download.directory_upgrade": True,
"plugins.always_open_pdf_externally": True #It will not show PDF directly in chrome 
})
driver = webdriver.Chrome(options=options)

If possible provide link where I can refer for javascript.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Based on this api-docs, I am able to set capabilities in Javascript except default download path. However, same can be achieved by await wdriver.setDownloadPath('C:\\Downloads');

var chrome = require("selenium-webdriver/chrome");

let downloadFilepath = "C:\\Downloads";
let options = await new chrome.Options();
options.addArguments("--disable-dev-shm-usage");
options.addArguments('--ignore-certificate-errors');
options.addArguments('--ignore-ssl-errors');
options.setUserPreferences({'download.default_directory': "C:\\Downloads"});
options.setUserPreferences({'download.prompt_for_download': false});
options.setUserPreferences({'download.directory_upgrade': true});
options.setUserPreferences({'plugins.always_open_pdf_externally': true});

driver = await chrome.Driver.createSession(options); 

Let me know if "download.default_directory" can be set using capabilities instead of wdriver.setDownloadPath.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!