5
I am using Python with the Selenium webdriver to automate the download of multiple PDF files. I get the PDF preview window. And now I would like to automatically download the file without popping up the window (save as).
I am trying to download the file with the code below, but still keeps popping the window (Save as).
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.download.dir", r"C:\downpdf")
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf")
fp.set_preference("pdfjs.disabled", "true")
btndownpdf = firefox.find_element_by_xpath('//*[@id="download"]').click()
I checked mimetype, and it’s the application/pdf.
– Hora
@Time I edited the answer, has the order of the elements also
– nosklo