Selenium-standalone -
npx selenium-standalone install Pro tip: Add --singleDriverInstall=chrome if you only need Chrome to save bandwidth. npx selenium-standalone start You will see output like:
before(async function() { // Ensure drivers are installed (safe to call every time) await install(); // Start the server server = await start(); console.log('Selenium ready'); });
// setup.js const { start, install } = require('selenium-standalone'); let server; selenium-standalone
Then, three weeks later, your CI build fails because the browser auto-updated but the driver didn’t.
If you have ever tried to set up a web automation suite (using Selenium WebDriver) on a new machine or a CI/CD pipeline, you know the drill. You download the ChromeDriver, make sure it matches your browser version, move it to /usr/local/bin , grant permissions, then do the same for GeckoDriver (Firefox) and EdgeDriver. You download the ChromeDriver, make sure it matches
// test.js const { remote } = require('webdriverio'); (async () => { const browser = await remote({ capabilities: { browserName: 'chrome', 'goog:chromeOptions': { args: ['headless', 'no-sandbox'] // Great for CI } }, port: 4444 // Your selenium-standalone port });
# Install drivers (runs fresh on every commit) - run: npx selenium-standalone install # Run server in background - run: npx selenium-standalone start & - run: npm test You can point your WebDriver tests (in Java,
Started Selenium server [PID: 1234] Selenium server running on port 4444 That’s it. You now have a Selenium Grid running at http://localhost:4444 . You can point your WebDriver tests (in Java, Python, JavaScript, Ruby, etc.) to this URL. Here is a minimal test script that connects to your selenium-standalone server:
