I want to use Puppeteer to generate PDF.
My environnement dev
I tried many tutorials on the web to do it.
But the code is blocked on browser.newPage()
const browser = await puppeteer.launch();
console.log(await browser.version()); //HeadlessChrome/90.0.4427.0
const page = await browser.newPage(); //after it does nothing
Here the debug (six last lines) :
puppeteer:protocol:RECV ◀ {"id":4,"result":{"sessionId":"B3D2567E07203D4A096A495710466966"}} +0ms
puppeteer:protocol:SEND ► {"sessionId":"B3D2567E07203D4A096A495710466966","method":"Page.enable","params":{},"id":5} +1ms
puppeteer:protocol:SEND ► {"sessionId":"B3D2567E07203D4A096A495710466966","method":"Page.getFrameTree","params":{},"id":6} +1ms
puppeteer:protocol:SEND ► {"sessionId":"B3D2567E07203D4A096A495710466966","method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":false,"flatten":true},"id
":7} +0ms
puppeteer:protocol:SEND ► {"sessionId":"B3D2567E07203D4A096A495710466966","method":"Performance.enable","params":{},"id":8} +0ms
puppeteer:protocol:SEND ► {"sessionId":"B3D2567E07203D4A096A495710466966","method":"Log.enable","params":{},"id":9} +0ms
Thanks,
I have fixed the issue of my case:
Use dumpio: true
to display log of Puppeteer.
After that, I found the error with libX11-xcb.so.1
and disabled the gpu.
browser = await chromium.launch({
args: ["--disable-gpu"]
});
https://github.com/puppeteer/puppeteer/issues/1543#issuecomment-349642975 https://github.com/microsoft/playwright/issues/4761#issue-770834723