Selenium-standalone
# Install drivers (runs fresh on every commit) - run: npx selenium-standalone install # Run server in background - run: npx selenium-standalone start & - run: npm test
Run your test while selenium-standalone start is running in another terminal. They will connect automatically. The CLI is great, but the real power is using the API inside your test setup hooks. selenium-standalone
Enter —the npm package that turns that headache into a single line of code. What is selenium-standalone ? Despite the name, this isn't the old Java Selenium Server. The selenium-standalone npm package is a lightweight CLI tool and library that automatically installs and manages Selenium WebDriver binaries for Chrome, Firefox, Edge, and Internet Explorer. # Install drivers (runs fresh on every commit)
after(async function() { await server.kill(); // Clean shutdown }); Enter —the npm package that turns that headache
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.
// 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 });