首页 > 解决方案 > 使用 selenium 下载 pdf

问题描述

尝试使用硒下载 pdf

我的代码


bills_href = selenium_controller.search_bills(browser)
    for count,i in enumerate(bills_href):
        r = requests.get(i, stream=True,verify=False)
        with open(("python%s.pdf")%(count), "wb") as pdf:
            for chunk in r.iter_content(chunk_size=1024):

                if chunk:
                    pdf.write(chunk)
bills_href = list of links of pdf

但是当我打开我的 PDF 文件时,它显示它已损坏,甚至无法打开它

标签: pythonpython-3.xselenium

解决方案


推荐阅读