[問題] —headless

看板Python作者 (choice)時間3年前 (2022/05/16 21:25), 編輯推噓1(103)
留言4則, 2人參與, 3年前最新討論串1/1
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

05/16 22:11, 3年前 , 1F

05/16 22:13, 3年前 , 2F
看起來用chrome/chromium是不行
05/16 22:13, 2F

05/17 00:49, 3年前 , 3F
換driver或試試weasyprint
05/17 00:49, 3F

05/17 00:51, 3年前 , 4F
pdfkit也可以轉
05/17 00:51, 4F
文章代碼(AID): #1YWb3Tgu (Python)
文章代碼(AID): #1YWb3Tgu (Python)