使用Python Selenium下载并保存PDF文件

时间:2018-10-07 16:13:01

标签: python selenium

我正在尝试从网上下载论文并另存为pdf。我尝试了以下代码,但始终失败。

from selenium import webdriver

download_dir = "C:\\Users\\liu\\Desktop\\Paper Survey Project\\PDF"
options = webdriver.ChromeOptions()

profile = {"plugins.plugins_list": [{"enabled": False, "name": "Chrome PDF Viewer"}],
           "download.default_directory": download_dir , "download.extensions_to_open": "applications/pdf"}

options.add_experimental_option("prefs", profile)
driver = webdriver.Chrome('D:\\Data Analysis\\chromedriver.exe', chrome_options=options)

driver.get('https://onlinelibrary.wiley.com/doi/epdf/10.1111/eufm.12036')

0 个答案:

没有答案