What is @testim/chrome-version?
@testim/chrome-version is an npm package that allows you to programmatically determine the version of Google Chrome installed on your system. This can be particularly useful for automated testing, CI/CD pipelines, and other scenarios where knowing the browser version is crucial.
What are @testim/chrome-version's main functionalities?
Get Chrome Version
This feature allows you to get the installed version of Google Chrome. The code sample demonstrates how to use the package to fetch and log the Chrome version.
const chromeVersion = require('@testim/chrome-version');
chromeVersion().then(version => {
console.log(`Chrome version: ${version}`);
}).catch(err => {
console.error('Error fetching Chrome version:', err);
});
Other packages similar to @testim/chrome-version
chrome-launcher
chrome-launcher is a package that not only helps in launching Google Chrome but also provides functionality to get the installed Chrome version. It is more feature-rich compared to @testim/chrome-version as it includes capabilities to launch Chrome with specific flags and configurations.
puppeteer
Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. While its primary use case is for browser automation, it also includes methods to fetch the browser version. Puppeteer is more comprehensive and is used for end-to-end testing and web scraping.
chrome-finder
chrome-finder is a package that helps in finding the path to the Chrome executable on different operating systems. It also provides functionality to get the Chrome version. It is similar to @testim/chrome-version but focuses more on locating the Chrome executable.
chrome-version
Finds the version of Chrome (or Chromium) that is installed on your machine.
Installation
npm install @testim/chrome-version
Use
(async () => {
const { getChromeVersion } = require('chrome-version');
const includeChromium = false;
const version = await getChromeVersion(includeChromium);
console.log(version);
})();
Testing
npm test
- If no version of chrome is installed on your machine
getChromeVersion
will return null.