Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
chromium-china
Advanced tools
Chromium binaries for your NodeJS project
node-chromium allows you to easily add Chromium binaries to your project and use it for automation, testing, web scraping or just for fun.
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
During the installation process node-chromium will find the latest suitable build for your platform, download it and extract into libraries folder. As soon as installation is finished, you are ready to use Chromium in your project:
const chromium = require('chromium');
const {execFile} = require('child_process');
execFile(chromium.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 chromedriver selenium-webdriver
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 chromium = require('chromium');
require('chromedriver');
async function start() {
let options = new chrome.Options();
options.setChromeBinaryPath(chromium.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 for Node.js projects
The npm package chromium-china receives a total of 0 weekly downloads. As such, chromium-china popularity was classified as not popular.
We found that chromium-china demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.