How to download PDF file using Selenium on Python
I have tried
options = webdriver.ChromeOptions()
prefs = {
"download.prompt_for_download": False, # To auto download the file
"plugins.always_open_pdf_externally": True # It will not show PDF directly in chrome
}
options.add_experimental_option("prefs", prefs)
But it does not work for me, the pdf file on the bottom tab is "Failed - Download Error" I'm using version:
- Python: 3.8.12
- Selenium: 4.1.0
- Chromedriver: 97.0.4692 google-chrome (using webdriver-manager for auto detecting Chrome version)
Please help!