question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blank screenshot with headless true, else fine.

See original GitHub issue

When running the following:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({headless: true});
  const page = await browser.newPage();
  let source = await page.goto('http://eu.patagonia.com/gb/en/home/');
  await page.screenshot({path: 'example.png', fullPage: false});
  await browser.close();
})();

The resulting screenshot is blank, however by setting headless to false the screenshot works perfectly. I don’t know if it is a site specific thing but I haven’t seen it on any other site, but AFAIK it shouldn’t make a difference if headless if true or false.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
iNeoOcommented, Apr 9, 2019

Up, did anyone find a solution ? (same pb with an other site using spip)

Edit: found a solution

      await page.setUserAgent('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3738.0 Safari/537.36');

resolve pb

https://github.com/GoogleChrome/puppeteer/issues/665

1reaction
eliseumdscommented, Feb 20, 2018

Same here v1.1.0, even with headless: false.

It’s still a bit mysterious, but I was having this issue when taking screenshots of massively long pages (in height) and concatenating them at the end. It apparently came back to normal after I set the max height to 5000px, but I’m definitely not confident with that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blank webpage using headless chrome, what to do?
Try this for headless (other option) and set window size, then you need to go to some webpage or it will take a...
Read more >
Screenshot with Katalon and Chrome headless mode - Archive
Screenshot with Katalon and Chrome headless mode ... And it works fine, the screenshot gets taken when using Katalon in normal mode. However,...
Read more >
Screenshot Tool: Part 4 – Gowitness | White Oak Security
The project's description is as follows: “gowitness is a website screenshot utility written in Golang, that uses Chrome Headless to generate ...
Read more >
How GitLab switched to Headless Chrome for testing
We now have a truly accurate way to test GitLab within a real, modern browser. The switch has improved our ability to write...
Read more >
[chromium-discuss] Re: Screencast frame doesn't trigger every ...
[1] https://cs.chromium.org/chromium/src/headless/lib/ ... I implemented 2 different script to compare screenshot and screencast. ... awaitPromise: true
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found