• Node: 8.7.0
  • Puppeteer: 0.12.0
  • Windows: 7 Professional / service pack: 6.1.7601 Service Pack 1 Build 7601

The current company I am working for has me using a typical Windows machine within a typical corporate environment.

Wanting to quickly start writing some end-to-end tests for the web application I am working on I decided to give Puppeteer a try. However, when trying to run the example:

let browser;
puppeteer.launch()
  .then(b => {
    browser = b;
    return browser.newPage();
  })
  .then(page => page.goto('https://www.google.com'))
  .then(response => {
    console.log('Page loaded with status code: ' + response.status);
    browser.close();
  });

a Chromium instance would appear on the screen, so not headless, and sit there doing nothing until the script timed out.

What ended up working was to first manually start up the Chrome instance (as detailed here https://www.sitepen.com/blog/2017/10/04/browser-automation-with-puppeteer)

/c/Program Files (x86)/Google/Chrome/Application$ ./chrome.exe --headless --remote-debugging-port=9222 --disable-gpu
 
DevTools listening on ws://127.0.0.1:9222/devtools/browser/a36d7543-166f-4a7f-9449-fc103fa4d7e2

And then use puppeteer.connect() instead of puppeteer.launch().

puppeteer.connect({browserWSEndpoint : 'ws://127.0.0.1:9222/devtools/browser/a36d7543-166f-4a7f-9449-fc103fa4d7e2'});

And things started working smoothly.

(Also shout-out to Git Bash which I have found to be a smoother Unix-like command-line interface for Windows than Cygwin).