What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
For a screenshot of a Rails page as a user sees it, capture it in a system test: visit the page with Capybara, perform any required interactions, then call take_screenshot. Rails system tests drive a real browser, so the image reflects the rendered page and its JavaScript behavior. For a browser-independent image of a URL, use a screenshot service instead; an example with ScreenshotNeo appears after the Rails setup.
Capture a page in a Rails system test
Rails provides screenshot support through its system-testing workflow. A system test is appropriate when the image needs to show the browser-rendered result, including the state produced by JavaScript or user actions. The screenshot records the page at the moment you call the helper, so put it after navigation and after any interactions that establish the state you want to inspect.
In a Rails application with the usual system-test setup, add a test under test/system or extend an existing one:
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 →require "application_system_test_case"
class UsersTest < ApplicationSystemTestCase
test "shows the users page" do
visit users_url
take_screenshot
assert_selector "h1", text: "Users"
end
end
ApplicationSystemTestCase supplies the Rails system-test base class and Capybara integration. The call to visit opens the route in the test browser; take_screenshot captures the current browser state. The assertion is not required for capturing an image, but it makes the test verify that the intended page loaded.
#1 Best Overall
Run the test with the test command used by your Rails app, for example:
bin/rails test test/system/users_test.rb
Use the file path for your own test. If your project uses a different test runner or system-test directory, retain the same sequence in the corresponding browser test: navigate, establish the desired state, capture.
Capture after the interaction you need
A screenshot is not a prediction of the page’s final state; it is an image of the state at the time of capture. For example, if the image should show a menu opened by a click, click the menu before capturing:
test "shows the account menu" do
visit root_url
click_button "Account"
take_screenshot
assert_selector "nav", text: "Sign out"
end
Likewise, fill a form, select a tab, or wait for a result before taking the image if that is what the screenshot is meant to document. An assertion after the capture can help diagnose whether the expected element was present, but it will not change the already-saved image.
Choose the browser and viewport
The browser driver and screen dimensions determine what the test renders. Rails documents Selenium with Chrome as the default system-test configuration in its current testing guide. The guide describes choosing a browser for Selenium, setting a screen size, and passing driver-specific options; it also covers headless Chrome or Firefox and remote browser configurations. The documented default screen size is 1400×1400 pixels. Treat that as the guide’s default, not as a requirement or a universal default for every Rails version or custom test setup.
Configure the driver in the system-test base class when the default browser or viewport is not suitable. A typical Rails configuration has this shape:
Rank #2
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end
Use the exact driver options supported by the Rails and Selenium versions installed in your application. If your project already has an ApplicationSystemTestCase, adjust its existing driven_by configuration rather than defining a competing base class. A different viewport can be set by changing the dimensions, for example screen_size: [1280, 800], when that is the size you intend to represent.
Recommended Free Tools
Headless, visible, or remote execution
- Headless local browser: useful for automated runs where no desktop window is needed. Confirm that the browser and driver are installed in the local or CI environment.
- Visible local browser: useful while developing or diagnosing a test because you can observe the browser interactions. Whether this is available depends on the driver configuration and environment.
- Remote browser: useful when browser execution is provided elsewhere. Rails documents remote browser configuration, but the remote driver’s setup and operational details depend on that external browser environment.
System tests exercise the complete browser experience and can take more setup and execution effort than tests that do not launch a browser. Prefer them when the screenshot needs to prove what a user-facing page actually rendered, rather than using a browser test for every isolated application behavior.
Find and preserve screenshot artifacts
Rails’ screenshot helper is designed for test screenshots. The Rails API reference for version 7.0.8.5 identifies tmp/screenshots as the default screenshot directory and documents Capybara.save_path for choosing another directory. The exact path and available options are version-specific; check the API documentation matching the Rails version in your application before building scripts around them.
For example, if you need artifacts to land in a chosen directory, configure Capybara’s save path in your test setup, using a path appropriate to your project:
Capybara.save_path = Rails.root.join("tmp", "system-test-artifacts")
Create or verify that the directory is writable in the environment running the tests, especially in CI. Keep generated screenshots out of source control unless they are intentional fixtures or review artifacts; CI systems commonly need an explicit artifact-retention step if files must be available after a job ends.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsSave page HTML for diagnosis
The Rails 7.0.8.5 API reference also documents saving page HTML through the helper’s html argument or the RAILS_SYSTEM_TESTING_SCREENSHOT_HTML environment variable. Use the matching documentation for your installed Rails release to confirm the supported syntax. HTML alongside an image can help distinguish a rendering issue from a test that captured the wrong page state, but it may contain page data that should not be retained or shared casually.
When to use a system test versus a URL screenshot
Use a Rails system test if you need the application itself, a signed-in session, test data, or a sequence of user interactions to produce the state being captured. The test runs against the Rails app in its test configuration and lets you assert on elements as well as save an image.
Use a URL screenshot service when the input is a publicly reachable URL and you want a screenshot without installing or configuring a browser driver in the Rails project. That is a different workflow: the service captures a URL, while a Rails system test can navigate through app-specific setup and interactions. Do not treat a remote URL capture as equivalent to a screenshot of a test user’s authenticated, locally seeded application state.
Or skip the browser setup
For a URL-based capture, ScreenshotNeo offers a single GET request that returns an image or PDF. Its capture workflow accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify page verdict and billing status in headers. ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents.
Install the Python dependency with python -m pip install requests, then set your API key in the code. The example saves the response body as a WebP file:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
Replace the example target URL with a page you are authorized to capture, and replace YOUR_API_KEY with your key. Check the response status and headers in production code before treating the response body as a valid image. The ScreenshotNeo API documentation describes request options and response details.
Equivalent cURL and Node.js calls
cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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}`);
The Node.js example returns a response object; check its status and handle the body as binary data before writing a file. For pages that require Rails test fixtures, browser interactions, or an authenticated test session, keep the system-test approach instead of substituting a URL-only capture.
Options for application workflows
ScreenshotNeo has 63 capture options. Relevant capabilities include full-page screenshots with lazy images loaded, element capture by CSS selector, dark mode, 12 device presets and custom viewports, retina scale, custom CSS or JavaScript, clicking an element before capture, hiding selectors, and waiting for a selector, delay, or network idle. It also supports PDF paper size, margins, landscape mode and page ranges; HTML or CSS to image; custom headers, cookies, user agent and Authorization; timezone and geolocation; transparent backgrounds; image resizing; request and resource blocking; caching with a chosen TTL; signed links for public <img> tags; 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 also work, which can make migration easier.
Rank #4
ScreenshotNeo’s plans are Free: 1,000 screenshots per month with no card; Starter: $5 for 3,000; Growth: $15 for 15,000; Pro: $39 for 60,000; Scale: $99 for 250,000; and Business: $249 for 1,000,000. Yearly billing gives two months free, and every feature is on every plan. The paid entry plan is $5 for 3,000 screenshots, but choose based on expected volume and your need for a browser-driven Rails session rather than price alone.
ScreenshotNeo is the URL screenshot option to try first here: it cleans common consent and popup clutter before capture, and only clean shots are billed. Sign up free for 1,000 screenshots a month with no card required.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common screenshot problems
No screenshot appears where expected
Check the configured Capybara save path and the Rails version’s screenshot-helper documentation; the Rails 7.0.8.5 reference lists tmp/screenshots as the default. Also verify the test reached the call to take_screenshot and that the test process can write to the destination. A screenshot created inside a temporary CI workspace may disappear when the job ends unless the workflow retains it as an artifact.
The image shows the wrong page or state
Move take_screenshot after the navigation and interactions that should appear in the image. If the page updates asynchronously, wait for a meaningful selector or assertion before capture rather than relying on an arbitrary short delay. This makes the test synchronize on the result it needs to show.
The browser fails to start in CI
Review the driven_by configuration and the browser and driver availability in that runner. A local browser installation does not imply that the same executable or display setup exists in CI. Use the supported headless or remote configuration for the environment, and pass only options recognized by the configured driver and installed versions.
The viewport or responsive layout is unexpected
Set screen_size explicitly in the system-test driver configuration when the documented default or your existing configuration does not match the layout under test. Also check whether the target browser applies device scale or other driver-specific behavior; the physical image dimensions alone do not prove which responsive breakpoint the page used.
Best Value
The screenshot exists but is blank or incomplete
Verify the test URL, app state, and required page data first. Then wait for the page element or content that marks readiness. A system-test screenshot captures the current browser state and cannot repair an application error, missing fixture, or failed JavaScript request.
Practical reliability and cost considerations
A system test is usually the more faithful choice for a Rails interaction, but it depends on a functioning browser environment and the app’s test data. Keep captures tied to a clear test scenario, choose an explicit viewport for layout-sensitive checks, and retain only the artifacts needed for debugging or review. No performance figure follows from Rails’ documented viewport size; capture time depends on the application, browser, driver, and environment.
Outdated 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 matchWindows 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 reinstallFor public URL captures, a hosted API avoids configuring a local browser, but it cannot recreate application state that exists only in your test process. ScreenshotNeo reports verdict and billing headers and does not bill the listed unsuccessful or cache-hit cases. Review the response and configure waits or capture options for the page rather than assuming every URL renders identically.
Frequently Asked Questions
Does Rails take screenshots automatically when a system test fails?
Rails includes take_failed_screenshot in system-test teardown, so failed browser tests can produce a debugging screenshot automatically.
Can a Rails screenshot include JavaScript-rendered content?
Yes. A system test drives a browser, so capture after the relevant JavaScript behavior has completed and the desired state is present.
Is the 1400×1400 system-test viewport mandatory?
No. It is the default screen size documented in the Rails testing guide cited for this article; system-test configuration can set another size.
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.

