Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect version of chrome used with puppeteer?

I read that puppeteer uses the latest version of chrome with it, where can I find which version it is using?

I don't want to access navigator object on the window to get it. Basically nothing runtime. Just want to know if puppeteer as a package lists out its dependency somewhere

Basically, I want to look up what all CSS and javascript support I can assume to be there from other sites like 'can I use' or chrome references.

like image 343
ashish singh Avatar asked Apr 23 '19 09:04

ashish singh


People also ask

How do I find Chrome Chromium version?

Open your Chrome browser. At the top of your Chrome browser, to the right of the address bar, click the More icon ( ). At the bottom of the menu, click Help, then About Google Chrome.

What browser does Puppeteer use?

Puppeteer uses Chrome DevTools protocol and the debugger protocol for Selenium is JSONWire. Both are used to perform clicks.

Does Puppeteer install Chrome?

By default, Puppeteer downloads and uses a specific version of Chromium so its API is guaranteed to work out of the box. To use Puppeteer with a different version of Chrome or Chromium, pass in the executable's path when creating a Browser instance: const browser = await puppeteer.


2 Answers

Use the browser.version() function to find out during runtime which version is used.

If you have the page object you can use it like this:

const version = await page.browser().version();

To find out which Chromium version is bundled with the puppeteer version without starting, you should check out the release notes, there is always a section about the Chromium version which is used.

Example (taken from release notes from v1.14.0):

Big Changes

  • Chromium 75.0.3738.0 (r641577)
like image 200
Thomas Dondorf Avatar answered Nov 02 '22 22:11

Thomas Dondorf


You can run this in node if you are in the root of your project (the same level as your node_modules dir)

(async()=>{const x = require("puppeteer"); console.log(await(await(await x.launch()).newPage()).browser().version())})()

My Result: > HeadlessChrome/91.0.4469.0

I find this method easier since you can run it on your server without doing file manipulations.

(Assuming you can't use top level async await)

like image 44
Daniel Avatar answered Nov 02 '22 23:11

Daniel