Skip to content

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.

// setup.js const { start, install } = require('selenium-standalone'); let server; selenium-standalone

No more "forgetting to start the Selenium server" errors on Monday morning. This is where selenium-standalone shines. Your pipeline becomes deterministic. Enter —the npm package that turns that headache

name: E2E Tests on: [push] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' - run: npm ci The selenium-standalone npm package is a lightweight CLI

// 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 });

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.

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: