Issue
I'm trying to batch-download a lot of files within the BlackBoard environment (used a lot on universities/schools around the world). I am able to retrieve the links where the files are but one mayor issue:
When the file is a .pdf-file, it is shown in a new browser-tab in stead of being downloaded. For e.g. .xlsx-files downloading with a click() works just fine..
Can I change the driversettings to change this behaviour? And how?
Edit
I updated the question in reaction to Ari's answer. It's now including more info on the actual plugin. Maybe that's usable to identify the plugin which has to be disabled..
Chrome PDF Viewer (2 files)
Name: Chrome PDF Viewer
Version:
Location: chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/
Type: BROWSER PLUGIN
Disable
MIME types: MIME type Description File extensions
application/pdf .pdf
Name: Chrome PDF Viewer
Description: Portable Document Format
Version:
Location: internal-pdf-viewer
Type: PPAPI (out-of-process)
Disable
MIME types: MIME type Description File extensions
application/x-google-chrome-pdf Portable Document Format
.pdf
Solution
Ari's answer was almost working properly. I only needed to encapsulate the plugin's name into a list:
chromeOptions = webdriver.ChromeOptions()
prefs = {"plugins.plugins_disabled" : ["Chrome PDF Viewer"]} # Here should be a list
chromeOptions.add_experimental_option("prefs",prefs)
chromedriver = "path/to/chromedriver.exe"
driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=chromeOptions)
The downloading now works just fine!
Answered By - Willem van Opstal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.