代码显示如下:
option = {'cookie': [(d['name'], d['value']) for d in driver.get_cookies()]}
pdfkit.from_url(driver.current_url, 'test.pdf',options=option)
The output PDF file is blank.
嗯,in pdfkit
official document,它需要一个完整的元组列表。
在您的代码中,您使用的是pdfkit
,它不是列表。您可以使用
dict5.items()
但是您的代码可以简化为:
ops = {'cookie':list(cookie_list)}