How to download pdf files using selenium in python

后端 未结 2 721
渐次进展
渐次进展 2021-01-25 07:36

I am trying to download pdf files from website using selenium but i am able to open file but its not auto downloadable using code.

Code:

chrome_profile          


        
相关标签:
2条回答
  • 2021-01-25 08:04

    Put this in your profile section of the code, it is disabling chrome PDF viewer and will trigger auto download

    "plugins.plugins_disabled": ["Chrome PDF Viewer"]
    
    0 讨论(0)
  • 2021-01-25 08:05

    Above problem is solved now

        prefs = {"plugins.always_open_pdf_externally": True}
        chromeOptions.add_experimental_option("prefs",prefs)
        chromedriver = "\path\chromedriver.exe"
        driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=chromeOptions)
    
    0 讨论(0)
提交回复
热议问题