Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Run Chrome without a visible window by configuring Rails system tests to use Selenium’s :headless_chrome driver, then make sure Chrome and a compatible driver are installed wherever the session starts. If Chrome runs in another container, switch Selenium to a remote URL and make the Rails test server reachable from that browser container.
Choose where Chrome will run
There are two supported deployment patterns:
- Local browser: Chrome, its driver, Rails, and the test process run in the same VM, container, or CI worker. This is the simplest arrangement because the test can use the local browser executable and localhost networking.
- Remote browser: Rails connects to Selenium Server or another WebDriver service in a separate container or machine. This keeps browser dependencies out of the Rails image, but requires a reachable Selenium URL and network routing from Chrome to the Rails app.
The Rails system-test example below is the direct path for Minitest-based Rails applications. RSpec, Cucumber, custom Capybara drivers, and production automation jobs use their own integration points, although the same Selenium and Chrome requirements apply.
Prerequisites for a local headless session
- A Rails application with system tests enabled.
- Google Chrome or Chromium installed in the environment that launches the browser.
- Selenium’s browser-driver support available to the application, with the driver executable discoverable by the process.
- A test user that can launch Chrome. Do not run the browser as root or another privileged account.
Driver installation is platform- and runtime-specific. Use the instructions for your operating system, base image, and installed Chrome version rather than copying a package command intended for a different distribution. Keep Chrome and ChromeDriver current and verify that the selected versions work together. A missing driver executable is one of the most common first-run failures.
Configure Rails system tests for headless Chrome
Put the driver configuration in application_system_test_case.rb, normally under test/application_system_test_case.rb:
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome
end
using: :headless_chrome tells Rails to create a Selenium Chrome session without opening a visible desktop window. Rails and Capybara still start and address the application as a normal system test. Additional Capybara settings can be added to this class when your application needs a custom server, host, port, or wait behavior.
Add a minimal system test
Create a test that exercises a page requiring JavaScript. The exact route and assertion depend on your application; this example assumes a home page containing a heading:
require "application_system_test_case"
class HomePageTest < ApplicationSystemTestCase
test "loads the home page in headless Chrome" do
visit "/"
assert_selector "h1"
end
end
Run the system-test command used by your Rails version and test setup, such as the project’s configured bin/rails test:system task. If your project uses a different test framework, invoke that framework’s browser-test command after configuring its Selenium driver.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Run Chrome in a separate container or service
A remote browser is useful when CI or a Docker deployment keeps Chrome separate from the Rails process. Rails’ documented pattern reads a Selenium endpoint from SELENIUM_REMOTE_URL and selects a remote browser when that variable is present:
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
url = ENV.fetch("SELENIUM_REMOTE_URL", nil)
options = if url
{ browser: :remote, url: url }
else
{ browser: :chrome }
end
driven_by :selenium, using: :headless_chrome, options: options
end
The value http://localhost:4444/wd/hub is often shown as an example endpoint, not a universal URL. Selenium Server versions and hosted browser services can expose different paths, so set SELENIUM_REMOTE_URL to the endpoint supplied by the service you actually run.
Make the Rails test server reachable
When Rails and Chrome are in different containers, 127.0.0.1 or localhost inside the browser container points back to that browser container. It does not point to the Rails container. Bind Capybara to an interface reachable on the container network and set an app host that resolves from Chrome:
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome,
options: {
browser: :remote,
url: ENV.fetch("SELENIUM_REMOTE_URL")
}
Capybara.server_host = "0.0.0.0"
Capybara.app_host = ENV.fetch("CAPYBARA_APP_HOST")
end
Set CAPYBARA_APP_HOST to a hostname and port that the browser service can resolve and reach, for example the Rails service name on your Docker or orchestration network. Use the actual network name and exposed port; do not assume that a host-machine port or loopback address is valid from another container.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Remote-browser checklist
- Start Selenium Server or the browser service and confirm its WebDriver endpoint from the Rails container.
- Set
SELENIUM_REMOTE_URLto that endpoint. - Bind the Capybara server to
0.0.0.0or another interface reachable by the browser container. - Set
CAPYBARA_APP_HOSTto the Rails container’s DNS name and listening port. - From the browser container, verify DNS resolution and TCP access to the Rails host and port.
- Run one small system test before adding parallel workers or a larger suite.
Control browser behavior when the defaults are not enough
Rails mediates driver configuration through Selenium and Capybara. Use the current Rails guide and the documentation for the Selenium/Capybara versions in your bundle before adding version-sensitive options. Common reasons to customize the setup include:
- Different browser location: choose local Chrome or a remote WebDriver endpoint according to where the executable actually runs.
- Application networking: set Capybara’s server host and app host when a remote browser cannot reach the default test URL.
- Framework integration: configure the driver in the RSpec or Cucumber integration point instead of copying the Rails Minitest class.
- Diagnostics: enable the logging and screenshots supported by your installed Selenium and test framework when investigating a failing session.
Avoid treating a sample option from one Rails, Selenium, or Chrome release as a permanent API contract. Confirm the option names against the versions installed in your application.
Troubleshoot the failures you are most likely to see
“Unable to obtain driver” or a missing executable error
Cause: Selenium cannot find the browser driver in the process environment, or the driver is not installed in the container that launches the session.
Fix: install the driver in that exact runtime, put its directory on PATH (or configure the supported driver location), and verify from the same user and container that Rails uses. In a remote arrangement, install it with the remote browser service, not only in the Rails image.
Chrome and ChromeDriver do not work together
Cause: the browser and driver versions are incompatible or one was updated without the other.
Fix: check both installed versions in the failing environment, update them together, and use current Chrome and ChromeDriver releases. There is no single pairing that applies to every operating system and image.
Chrome exits immediately on Linux
Cause: Chrome was launched as root or another privileged account, or the runtime user lacks a suitable browser environment.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Fix: run the test as an unprivileged account, inspect Chrome and Selenium logs, and ensure the container has the libraries and permissions required by the browser image. ChromeDriver’s security guidance specifically warns against privileged execution.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchThe remote session starts but the page never loads
Cause: the browser can contact Selenium, but it cannot resolve or connect to the Rails test server. Typical mistakes are a loopback app host, a service name unavailable on the browser network, or a blocked port.
Fix: confirm Capybara.server_host, Capybara.app_host, container DNS, firewall rules, and the listening port. Test reachability from the browser container itself, not only from the Rails container.
The configuration works locally but not in CI
Cause: CI uses a different Rails, Selenium, Chrome, driver, user, or container network configuration.
Fix: print the relevant versions and environment variables in the CI job, verify that the driver is installed in the job image, and compare the browser’s reachable hostname and port with the local setup. Recheck the current Rails guide for the installed Rails version.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Secure a server-side Chrome installation
ChromeDriver exposes a powerful automation interface. Run it as a dedicated, non-privileged test account with no access to sensitive local files or production credentials. Keep Chrome and ChromeDriver current, place the browser service inside a protected container or virtual machine, and restrict its network exposure.
- Keep Selenium and ChromeDriver ports on a trusted private network.
- Use firewall rules and ChromeDriver’s allowed-IP control when remote access is required.
- Do not publish a browser-control port to the internet merely to make a test pass.
- Separate test credentials and data from production systems.
- Review container permissions and logs after every browser-image update.
These controls matter more when Rails connects to a browser service over a network, because anyone who can reach the WebDriver endpoint may be able to drive the browser.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Reliability, performance, and operating cost
Local versus remote trade-offs
| Decision | Local Chrome | Remote Chrome |
|---|---|---|
| Browser location | Same environment as Rails and the test process | Separate container or service |
| Setup complexity | Fewer network settings; browser dependencies belong in the Rails or CI image | Requires a working Selenium URL, DNS, port access, and an app host reachable from Chrome |
| Runtime coupling | Browser and tests are updated and restarted together | Browser lifecycle and Rails lifecycle can be managed independently |
| Security boundary | Protect the test worker and local browser process | Also restrict the remote WebDriver and Selenium service ports |
| Failure surface | Driver discovery, browser startup, and local libraries | All local issues plus service availability and container networking |
Neither arrangement is inherently faster based on the available guidance. Measure your own suite if startup time matters. Remote execution can simplify image ownership, while local execution removes a network hop and usually has fewer moving parts.
Control costs by reusing a tested browser image, avoiding unnecessary browser restarts, and running only the system tests that require JavaScript. Keep browser, driver, and Rails versions pinned and update them deliberately so a surprise image refresh does not break CI.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Or skip the browser setup
If your goal is a clean screenshot or PDF rather than an interactive Rails system test, ScreenshotNeo provides a hosted website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Only clean shots are billed: bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are free, and each response reports the result through X-Page-Verdict and X-Billed headers.
One GET request is enough:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the complete parameter reference in the ScreenshotNeo documentation. The same request from Python:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
And Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const body = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', body));
ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Features include full-page lazy-image loading, CSS-selector element capture, dark mode, device presets, arbitrary viewports, retina scale, PDF paper and margin controls, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers and cookies, user-agent and authorization values, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account to start.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesFAQ
Can headless Chrome run without an X server?
Yes. Rails’ :headless_chrome driver is intended for a browser session without a visible window. The runtime still needs a compatible Chrome installation and its required libraries.
Should I use Chromium or Google Chrome?
Use the browser available and supported by your chosen Selenium setup, and keep its driver compatible. The configuration pattern is the same, but package names and version-management steps vary by image and operating system.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Is a remote Selenium URL required for every Rails server?
No. Use the local driver when Chrome runs with Rails. Set SELENIUM_REMOTE_URL only when the browser is provided by another service or container.
Why does a test pass in a browser on my laptop but fail headlessly?
Headless CI may use different browser and driver versions, viewport defaults, fonts, permissions, timing, or network routes. Capture logs, verify versions, and test the exact container and user used by the failing job.
Frequently Asked Questions
Can headless Chrome run without an X server?
Yes. Rails’ :headless_chrome driver is intended for a browser session without a visible window. The runtime still needs a compatible Chrome installation and its required libraries.
Should I use Chromium or Google Chrome?
Use the browser available and supported by your chosen Selenium setup, and keep its driver compatible. Package names and version-management steps vary by image and operating system.
Is a remote Selenium URL required for every Rails server?
No. Use the local driver when Chrome runs with Rails. Set SELENIUM_REMOTE_URL only when the browser is provided by another service or container.
Why does a test pass in a browser on my laptop but fail headlessly?
Headless CI may use different browser and driver versions, viewport defaults, fonts, permissions, timing, or network routes. Capture logs, verify versions, and test the exact container and user used by the failing job.
Recommended Free Tools
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

