Is it possible for Node.js running on a desktop to spawn a Chrome Browser window? I would like to start a Chrome Browser providing the window size and location when Node.js rece
Checkout https://www.npmjs.com/package/chrome-launcher:
Launch chrome:
const chromeLauncher = require('chrome-launcher');
chromeLauncher.launch({
startingUrl: 'https://google.com'
}).then(chrome => {
console.log(`Chrome debugging port running on ${chrome.port}`);
});
Launching headless chrome:
const chromeLauncher = require('chrome-launcher');
chromeLauncher.launch({
startingUrl: 'https://google.com',
chromeFlags: ['--headless', '--disable-gpu']
}).then(chrome => {
console.log(`Chrome debugging port running on ${chrome.port}`);
});
chrome-launcher opens a remote debugging port so you can also control browser instance using the DevTools protocol.
Puppeteer is another way to launch Chrome and interact with it using high level APIs.