
Security News
pnpm 10.12 Introduces Global Virtual Store and Expanded Version Catalogs
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
chromium-binary
Advanced tools
Chromium binaries (chromium version corresponds to package version) for Node.js projects
Chromium binaries for your NodeJS project
This is fork of node-chromium by Dmytro Tolstyi.
node-chromium allows you to easily add Chromium binaries of desired version to your project and use it for automation, testing, web scraping or just for fun. Chromium version will correspond to package version, i.e. if package version is 60.0.3112-0 then chromium 60.0.3112.0 will be installed.
Chromium is an open-source web browser developed and maintained by The Chromium Project. Google Chrome, also released in 2008, is a proprietary web browser developed and maintained by Google. The reason why Chrome and Chromium are tied to each other is that Chome borrows Chromium’s source code.
The main benefit of using Chromium is that it doesn't include all the proprietary modifications made by Google, thus it's more lightweight and more suitable for automation purposes.
You can see full list of differences in Fossbytes article.
Depending on your needs, you can install module into devDependencies (--save-dev
) or production dependencies (--save
).
npm install --save chromium-binary
During the installation process node-chromium will download corresponded chromium version and extract into libraries folder. As soon as installation is finished, you are ready to use Chromium in your project:
const chromiumBinary = require('chromium-binary');
const {execFile} = require('child_process');
execFile(chromiumBinary.path, ['https://google.com'], err => {
console.log('Hello Google!');
});
It's extremely easy to use node-chromium with selenium-webdriver to perform e2e tests without spawning browser UI. First, install all dependencies
npm install --save chromium-binary@60.0.3112-0 chromedriver@2.33.0 selenium-webdriver@3.6.0
After the installation is finished, create simple script that opens Google Search home page and takes it's screenshot in headless mode.
const fs = require('fs');
const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const chromiumBinary = require('chromium-binary');
require('chromedriver');
async function start() {
let options = new chrome.Options();
options.setChromeBinaryPath(chromiumBinary.path);
options.addArguments('--headless');
options.addArguments('--disable-gpu');
options.addArguments('--window-size=1280,960');
const driver = await new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
await driver.get('http://google.com');
console.log('Hello Google!');
await takeScreenshot(driver, 'google-start-page');
await driver.quit();
}
async function takeScreenshot(driver, name) {
await driver.takeScreenshot().then((data) => {
fs.writeFileSync(name + '.png', data, 'base64');
console.log('Screenshot is saved');
});
}
start();
MIT
FAQs
Chromium binaries (chromium version corresponds to package version) for Node.js projects
The npm package chromium-binary receives a total of 1,207 weekly downloads. As such, chromium-binary popularity was classified as popular.
We found that chromium-binary demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.