12

I am trying to open a page through puppeteer but it's not throwing any error and entire code is getting executed by chromium doesn't show up.

const puppeteer = require('puppeteer');

(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
console.log('there');
await page.goto('https://google.com');
console.log('yes');
//   await page.screenshot({path: 'example.png'});

//   await browser.close();
})();
Akash Verma
  • 344
  • 3
  • 12

1 Answers1

21

Quote from the Puppeteer documentation:

Puppeteer launches Chromium in headless mode. To launch a full version of Chromium, set the 'headless' option when launching a browser:

const browser = await puppeteer.launch({headless: false}); // default is true

“Headless” means when your code is executed, you won't actually see any browser window, the code is run in the browser purely on the command line.

Patrick Hund
  • 19,163
  • 11
  • 66
  • 95