ScreenshotNeo

BlogHow-to

How to Get the Browser Provider Name in Puppeteer

Use Puppeteer’s browser.version() to get the connected browser’s name and version. Learn how it differs from user-agent data and how to handle the result safely.

By the ScreenshotNeo team4 October 20266 min read

Use await browser.version() on Puppeteer’s Browser instance. It returns a Promise<string> containing the connected browser’s name and version, such as HeadlessChrome/61.0.3153.0, Chrome/61.0.3153.0, or Firefox/116.0a1. Treat the returned value as a descriptive string: Puppeteer warns that its format can change with future browser releases.

Get the browser name and version

Once Puppeteer has launched a browser or connected to one, call version() on that browser object:

const browserNameAndVersion = await browser.version();
console.log(browserNameAndVersion);

The method identifies the browser represented by that Browser instance. It is not a separate provider-name field: the result combines a browser name and version in one string.

Complete runnable example

This example launches Puppeteer’s default browser, prints the reported identity, and closes the browser even if an error occurs. Install Puppeteer first with npm install puppeteer; its package includes a compatible browser setup.

const puppeteer = require('puppeteer');

(async () => {
  let browser;
  try {
    browser = await puppeteer.launch({ headless: true });
    const browserNameAndVersion = await browser.version();
    console.log(browserNameAndVersion);
  } catch (error) {
    console.error('Could not read the browser version:', error);
    process.exitCode = 1;
  } finally {
    if (browser) {
      await browser.close();
    }
  }
})();

For an ES module, use import puppeteer from 'puppeteer'; and keep the same launch and await browser.version() calls. If your code already has a connected browser object, call the method on that object instead of launching another browser.

What the result means

Puppeteer documents example values for Chrome, HeadlessChrome, and Firefox. The exact string depends on the browser behind the instance, and the format may change. Log or display the complete value for diagnostics. If you need a broad family label, parse cautiously and handle unrecognized values; do not make application behavior depend on an undocumented rigid pattern.

Configured browser versus runtime browser

Puppeteer supports Chrome and Firefox. Its configuration can select a default browser, with Chrome documented as the default; the PUPPETEER_BROWSER environment variable can override the configuration. That selection tells you what your setup requests. browser.version() tells you what the connected instance reports at runtime. When your application controls browser selection and needs a stable contract, retain the choice in your own configuration and use the runtime result for reporting or diagnostics.

Browser releases paired with Puppeteer releases are documented in Puppeteer’s supported browsers guide. Check that guide when debugging a browser/Puppeteer compatibility issue, since the pairing changes by release.

Do not confuse it with the user agent

browser.userAgent() returns the browser’s original user-agent string. A page can override its user agent with Page.setUserAgent(), so user-agent data answers a different question and may not describe what a particular page currently sends. Use browser.version() to ask Puppeteer for the connected browser’s name and version.

See Puppeteer’s API references for Browser.version() and Browser.userAgent().

Options and edge cases

  • Await the method: it returns a promise. Without await, your variable is a promise rather than the version string.
  • Use the correct instance: if Puppeteer connects to a remote browser, call the method on the returned connected Browser object. The result describes that instance, not necessarily a local browser installation.
  • Expect format changes: the documented examples are illustrative, not a promise of a permanent prefix, delimiter, or version scheme.
  • Handle unknown values: new browser builds or browser families can produce values your code has not seen. Preserve the raw string and make fallback behavior explicit.
  • Do not infer page identity from it: the browser instance’s name/version does not tell you whether a page has overridden its user agent.
  • Choose the source based on the question: use configuration for the browser your program intends to select, and the method for the browser instance’s reported identity.

Troubleshooting

Symptom Likely cause Fix
The output is [object Promise] or looks like a promise The call was not awaited. Use const value = await browser.version() inside an async function, or handle the promise with .then().
browser.version is not a function The variable is not the Puppeteer Browser instance, or another value overwrote it. Check the result of puppeteer.launch() or puppeteer.connect() and call the method on that object.
The browser fails before a value is returned Launch or connection failed, or the browser process is unavailable. Handle launch/connection errors first; verify the selected browser is installed and compatible with the Puppeteer version. Consult the supported browser mapping.
The returned name differs from the configured choice The runtime instance may have been launched or selected elsewhere, or configuration was overridden. Inspect the launch/connect path and PUPPETEER_BROWSER; compare the requested choice with the instance’s reported value.
A user-agent check disagrees with the browser version A page may have overridden its user agent, or the two APIs are being treated as equivalent. Use browser.version() for browser name/version and inspect the relevant page’s user agent separately when that is the actual requirement.
String parsing breaks after an upgrade The code assumed a fixed undocumented format. Keep the raw value, loosen parsing, add a safe unknown-value path, or use your own launch configuration when you need a stable family choice.

Performance, reliability, and cost

browser.version() is a small asynchronous metadata call. Call it when needed, such as once per browser session for logs or diagnostics; repeatedly polling it is usually unnecessary. The important reliability concern is the format contract: Puppeteer documents the returned value as a string but warns that its format can change. Avoid using a parsed version string as the sole control for critical behavior unless you own and validate that contract.

The method itself does not create a browser or capture a page. Browser startup and page capture are separate operations with their own resource and runtime costs. If your goal is to obtain a website screenshot rather than manage a Puppeteer browser, ScreenshotNeo offers a one-request screenshot API and an MCP server. See the ScreenshotNeo website for product details.

Or skip the browser setup

For a website screenshot, ScreenshotNeo returns an image or PDF from one GET request, without requiring you to launch and maintain Puppeteer. Its API documentation covers the request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const image = Buffer.from(await res.arrayBuffer());
require('node:fs').writeFileSync('shot.webp', image);

ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses report the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for free and get 1,000 screenshots a month with no card.

FAQ

Does browser.version() return only a provider name?

No. It returns a string representing the browser’s name and version together.

Can it identify Firefox?

Yes. Puppeteer supports Firefox as well as Chrome, and its API examples include a Firefox result.

Is the result suitable as a permanent browser identifier?

Use it as runtime-reported descriptive information. Puppeteer warns that the string format can change, so keep parsing tolerant and retain your configured browser choice if you need a stable application-level setting.

Where can I check which browser versions pair with my Puppeteer release?

Use Puppeteer’s supported browsers guide, which documents release-specific browser support.