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.

Headless mode on Windows 7 causes timeout, never completes

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.3.0
  • Platform / OS version: Windows 7 x64
  • URLs (if applicable):
  • Node.js version: 8.9.4

What steps will reproduce the problem?

const puppeteer = require('puppeteer')
const devices = require('puppeteer/DeviceDescriptors')

const captureScreenshot = async () => {
  const browser = await puppeteer.launch({headless:true})
  const page = await browser.newPage()
  await page.goto('https://www.google.com/')
  await page.screenshot({path: 'screenshot.png', fullPage: true})
  await browser.close()
}

captureScreenshot()
  1. npm install puppeteer
  2. node index.js

What is the expected result? Script runs and outputs screenshot.png into working directory.

What happens instead? Script runs for a long time until it produces timeout warnings.

(node:4492) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): Error: Navigation Timeout Exceeded: 30000ms exceeded
(node:4492) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
 Node.js process with a non-zero exit code.

If puppeteer.launch option “headless” is set to false, same script delivers expected result in about 5 seconds.

Capturing screenshot from http://info.cern.ch/ works in headless mode, so issue might be related to complexity of the page.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

38reactions
TheCloudlessSkycommented, Apr 17, 2018

Does this work?

const browser = await puppeteer.launch({
  headless: true,
  args: [
    '--proxy-server="direct://"',
    '--proxy-bypass-list=*'
  ]
});
5reactions
TheCloudlessSkycommented, Apr 17, 2018

@joshas It shouldn’t be… but I’ve ran into serious problems with this too. I’ve added this comment to my code for those arguments:

    // Headless mode sometimes ignores the default OS proxy (by default none). This causes some
    // machines to take ~2 seconds per-request and significantly inflate the test suite run
    // time by more than 10x. This was also sometimes a problem when running PhantomJS. The
    // suggested workaround is to explicitly bypass all proxies:
    // https://github.com/Codeception/CodeceptJS/issues/561#issuecomment-373666779
    // https://peter.sh/experiments/chromium-command-line-switches/#proxy-server
    // https://peter.sh/experiments/chromium-command-line-switches/#proxy-bypass-list
Read more comments on GitHub >

github_iconTop Results From Across the Web

Timeout Error occurred When run a script on Headless ...
I was having a similar problem, normal Chrome driver worked fine, but headless chrome always timed out. I found out that for responsive...
Read more >
Group Policy Screensaver setting isn't working in Windows
Cause. The default ScreenSaver Timeout is configured in the registry at this location: Registry subkey: HKEY_CURRENT_USER\Control Panel\Desktop.
Read more >
Reference Topics :: NVIDIA Nsight VSE Documentation
TDR stands for Timeout Detection and Recovery. ... TCC mode disables Windows graphics and is used in headless configurations, whereas WDDM ...
Read more >
Getting Started with Headless Chrome - Chrome Developers
The easiest way to get started with headless mode is to open the Chrome binary from the command line. If you've got Chrome...
Read more >
List of Chromium Command Line Switches - Peter Beverloo
Note: # must always be in [1, 8]; otherwise it is ignored by the Windows ... the browser process launched in background mode...
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