puppeteer / puppeteer

JavaScript API for Chrome and Firefox
https://pptr.dev
Apache License 2.0
88.24k stars 9.07k forks source link

Why do I get a different outcome from headless vs non-headless #10321

Closed espenrs closed 1 year ago

espenrs commented 1 year ago

This isn't a reproducible bug as the website is on-premises and I don't have control of the code. Is it also not a question that is viable for Stack Overflow.

But I need to know if this is a known issue in general. I run the exact same code headless and none-headless, and only the none-headless is showing the page as it should be. Running it headless and it seems like something is off with the css as the content is scattered and placed "randomly".

I have tried various versions of Puppeteer, Chrome, and even Edge. Still the same exact problem. Have not noticed this with any other websites and they all work. Even this one worked until they moved it to a different server. But that shouldn't mean anything as I thought the idea with headless was to be able to render just as none-headless. So if there is something wrong with the website it should also be wrong when running none-headless.

Any ideas?

OrKoN commented 1 year ago

I think this article should answer your question: https://developer.chrome.com/articles/new-headless/ In short, the old headless mode is practically a different browser implementation based on Chromium's content layer.

OrKoN commented 1 year ago

You should try the new headless mode and it should produce the same results and headful (if not, please report a bug).