To download pdf file in Chrome automatically using Selenium. You should configure these capabilities:
{
"prefs": {
"download.default_directory": "Your download folder",
"download.directory_upgrade": true,
"download.prompt_for_download": false,
"plugins.always_open_pdf_externally": true,
"profile.default_content_settings.popups": "0",
"profile.content_settings.exceptions.automatic_downloads.*.setting": "1"
},
"args": [
"--no-sandbox",
"--disable-dev-shm-usage"
],
"useAutomationExtension": "false"
}
Please clone this sample project and change the “download.default_directory” to your desired folder and run a sample test case: GitHub - duyluonganh/kat-download-file
Thanks