Run JavaScript in a browser from the command line or programmatically, with Electron as the default browser.
browser-run is a Node.js library and CLI tool that executes JavaScript code inside a real browser environment from the command line or programmatically. It solves the problem of automating browser-based code execution for testing, scripting, or debugging by providing a simple interface to run code in browsers like Electron, Chrome, or Firefox.
Developers and testers who need to run JavaScript in a browser for automated testing, CI/CD pipelines, or command-line scripting without manual browser interaction.
Developers choose browser-run for its simplicity, seamless integration with tools like browserify, and flexibility in supporting multiple browsers and headless environments, reducing the overhead of browser automation setup.
Run code inside a browser from the command line
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Install via npm and start running code immediately with the CLI, as shown in the basic echo example where stdin/stdout handle input and output.
Supports Electron (default), Chrome, Firefox, IE, or Safari via the --browser flag, offering flexibility without vendor lock-in.
Provides explicit examples for GitHub Actions and Travis using Xvfb, making it easy to integrate into automated pipelines without a display.
Directly pipes browserify bundles into the browser for testing, streamlining build-and-test workflows as demonstrated in the README examples.
Requires Xvfb setup for headless testing on Linux, adding configuration overhead compared to native headless browsers like Chrome Headless.
Primarily forwards console logs; lacks built-in APIs for simulating user actions (e.g., clicks, typing), restricting it to code execution rather than full automation.
Defaults to Electron, which can consume more memory and CPU than lightweight browser engines, potentially slowing down tests in resource-constrained environments.