OiO.lk Blog java Disable built-in PDF viewer in chromedriver and download the files automatically in specified folder
java

Disable built-in PDF viewer in chromedriver and download the files automatically in specified folder


I am having issues downloading the files using chromedriver. I am using below chrome preferences but it’s still opening me PDF Viewer with open button.

profile = {"plugins.plugins_disabled": ["Chrome PDF Viewer"],
           # Disable Chrome's PDF Viewer
           "download.default_directory":  "/Users/xyz/Downloads",
           "download.extensions_to_open": "applications/pdf",
           'w3c': True,
           "plugins.always_open_pdf_externally": True,
           "profile.default_content_settings.popups": 0,
           "download.prompt_for_download": False,
           "savefile.default_directory": "/Users/xyz/Downloads",
           "pdfjs.disabled": True,
           "savefile.type": 1,
           "download.directory_upgrade": True}
chrome_options.add_experimental_option("prefs", profile)

enter image description here

I am expecting pdf should be downloaded in desired folder instead of opening PDF viewer window.



You need to sign in to view this answers

Exit mobile version