作者bchoice (choice)
看板Python
標題[問題] —headless
時間Mon May 16 21:25:47 2022
https://i.imgur.com/XfLozFR.jpg
各位高手,我的需求是將網頁存成pdf,我有找到方法,但是他一定要用—headless的方法,才能存成功,如果把—headless拿掉就會跳以下錯誤,請問有解嗎?我不想用無頭的方式
selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Printing is not available"}
(Session info: chrome=101.0.4951.64)
-----
Sent from JPTT on my iPhone
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.217.195.17 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1652707549.A.AB8.html
→ TheOneisNEO: 看起來用chrome/chromium是不行 05/16 22:13
→ noworneverev: 換driver或試試weasyprint 05/17 00:49
→ noworneverev: pdfkit也可以轉 05/17 00:51