How to check for the browser version in Puppeteer

Puppeteer is a Node.js library developed by Google that provides a high-level API to control headless and headful browsersA headless browser operates in the background, utilizing the essential functions of a browser without displaying a graphical interface to the user. In contrast, a headful browser requires a full loading of both core functionalities and the user interface, allowing the operator to visually observe the actions taking place. over the DevTools Protocol.

Unless we specify a different one executablePath, Puppeteer launches the Chromium browser by default. It is designed to work seamlessly with Chromium, an open-source browser project that serves as the foundation for several browsers, including Google Chrome.

In this Answer, we will learn how to check for the browser version in Puppeteer.

Syntax

The following is a syntax used to retrieve the browser version of the browser launched by the Puppeteer.

await browser.version();

The await keyword in JavaScript is used to pause the execution of the script until the Promise returned by the following method is resolved.

Interested in learning more about the await keyword? Check out the What is the await operator in JavaScript Answer for further details!

Example

Execute the following code example by clicking the “Run” button below. You will see an instance of the Chrome browser launched within our widget in the “Output” tab and the version of that browser logged in the “Terminal” tab.

const puppeteer = require('puppeteer');
(async () => {
  console.log("Opening the browser in headful mode.....")
  // Launch a headful browser to verify the version
  const browser = await puppeteer.launch({
    headless: false,
    args: ['--no-sandbox']
  });
  console.log("Browser has successfully been opened!")
  // Check the browser version
  browserVersion = await browser.version();
  console.log("The browser version is: ", browserVersion);
  // Close the browser
  // await browser.close();
})();
Launching a browser and checking the version of the browser with the Puppeteer library

We have launched the browser in headful mode, and the browser is opened in the “Output” tab. Verify the browser version retrieved with the browser.version() method by comparing it with the browser version we manually checked from the browser, which is opened in the “Output” tab.

Unlock your potential: Puppeteer fundamentals series, all in one place!

To deepen your understanding of Puppeteer, explore our series of Answers below:

Free Resources

HowDev By Educative. Copyright ©2025 Educative, Inc. All rights reserved