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 →Use a real browser session, sign in through the site’s normal flow, verify that the protected page—not a login redirect—has loaded, and save the screenshot before closing the session. In Ruby, Capybara with a Selenium driver is convenient for Rails and system tests; direct Selenium gives lower-level control. Both approaches preserve cookies and other browser state between login and capture.
What an authenticated screenshot workflow must do
An authenticated capture is different from downloading a public URL. The browser must render JavaScript, accept the application’s cookies, follow redirects, and retain the session created by login. A reliable workflow has five stages:
- Start a browser-backed driver rather than Capybara’s default
rack_testdriver. The default driver does not run a remote browser and is unsuitable for JavaScript-heavy or remote pages. - Open the sign-in page and complete an authorized login, preferably with a dedicated test account.
- Wait for a dependable success signal, such as the expected URL or an element visible only to signed-in users.
- Visit the protected URL in the same browser session and verify that it loaded instead of redirecting to login or showing an access-denied page.
- Save the viewport or element screenshot, then close the browser in an
ensureblock.
Prerequisites and safe test setup
- Ruby and Bundler installed.
- A browser supported by your selected Selenium driver, such as Chrome.
- The matching Selenium browser driver available through your project’s normal setup.
- An account that you are authorized to automate. Use a non-production account when possible.
- A writable output directory such as
tmp/screenshots.
Do not place passwords, session cookies, authorization headers, or one-time codes in source control. Pass secrets through environment variables or your CI secret store. Screenshots may contain names, invoices, messages, or other customer data, so treat the image files as confidential artifacts.
Option 1: Capybara with Selenium
Capybara is a good fit when your project already uses Rails system tests, RSpec, or another Capybara-based test suite. It provides a session API while delegating browser work to the configured driver.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Minimal session pattern
require "capybara"
session = Capybara::Session.new(:selenium)
session.visit("https://example.com/login")
# Complete the site's authorized login here.
# For example, fill the site's actual fields and submit its form.
# Then wait for a signed-in URL or element.
session.visit("https://example.com/account")
# Replace this with an application-specific assertion.
raise "Not signed in" unless session.has_current_path?("/account")
Dir.mkdir("tmp") unless Dir.exist?("tmp")
session.save_screenshot("tmp/account.png")
save_screenshot forwards the request to the selected driver. The selectors, login controls, and success condition must match the target application; there is no universal username field or post-login URL.
Waiting for the signed-in state
Prefer a condition that represents application readiness over an arbitrary sleep. Examples include a final URL, a dashboard heading, an account-menu control, or a user-specific element. A fixed delay can be useful for a known animation, but it does not prove that authentication or data loading completed.
session.visit("https://example.com/login")
# session.fill_in "Email", with: ENV.fetch("TEST_EMAIL")
# session.fill_in "Password", with: ENV.fetch("TEST_PASSWORD")
# session.click_button "Sign in"
unless session.has_css?("[data-testid='account-menu']", wait: 15)
raise "Login did not reach the signed-in state"
end
session.visit("https://example.com/account")
unless session.has_css?("h1", text: "Account", wait: 15)
raise "Protected page did not load"
end
session.save_screenshot("tmp/account.png")
Option 2: Direct Selenium Ruby
Use Selenium directly when you need explicit browser commands, window management, cookies, or driver capabilities without Capybara’s abstraction.
require "selenium-webdriver"
options = Selenium::WebDriver::Chrome::Options.new
# options.add_argument("--headless=new") # Enable in CI if appropriate
driver = Selenium::WebDriver.for(:chrome, options: options)
begin
driver.navigate.to("https://example.com/login")
# Automate the site's authorized login with its real selectors.
# email = driver.find_element(name: "email")
# password = driver.find_element(name: "password")
# email.send_keys(ENV.fetch("TEST_EMAIL"))
# password.send_keys(ENV.fetch("TEST_PASSWORD"))
# password.submit
wait = Selenium::WebDriver::Wait.new(timeout: 15)
wait.until { driver.find_element(css: "[data-testid='account-menu']").displayed? }
driver.navigate.to("https://example.com/account")
wait.until { driver.find_element(css: "h1").text.include?("Account") }
Dir.mkdir("tmp") unless Dir.exist?("tmp")
driver.save_screenshot("tmp/account.png")
ensure
driver.quit
end
Selenium’s Ruby screenshot method saves a PNG of the viewport to the path you provide. The ensure clause matters: without it, a failed assertion can leave a browser process running in local development or CI.
Viewport, full-page, and element captures
Viewport screenshots
Assume viewport capture unless your installed driver explicitly supports more. It records what is visible in the current browser window and is the most portable behavior.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Full-page screenshots
Full-page support depends on the browser driver and version; it is not universal. If your driver exposes a full-page option, verify it in that environment rather than assuming that a flag works everywhere. Otherwise, resize or scroll deliberately, or capture sections separately.
One-element screenshots
When the requirement is a report card, invoice, chart, or other component, capture the element instead of the entire page:
element = driver.find_element(css: "[data-testid='invoice']")
element.save_screenshot("tmp/invoice.png")
Element screenshot output and supported formats can vary with the Selenium and browser versions installed, so use the format expected by your version and inspect the resulting file in CI.
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 matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Reusing authentication state
Logging in for every run is simple and limits the lifetime of session data. Reusing a browser profile or saved state can make repeated captures faster, but it creates a more valuable secret. Browser state may contain cookies and headers that can impersonate the account; protect it like a password.
- Store state outside the repository and exclude it from backups and build artifacts unless required.
- Restrict file permissions and CI access.
- Use short-lived, least-privilege test accounts.
- Rotate or revoke the account if state is exposed.
- Remember that applications can use cookies, local storage, IndexedDB, passkeys, or session storage. A state mechanism that covers only cookies may not reproduce the real login.
Re-authenticate when correctness matters more than startup time. Reuse state only when you understand exactly what your application stores and how the state is invalidated.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Reliability checks before saving the file
- Check the current URL for an unexpected
/login, SSO, or error route. - Assert a protected-page marker, not merely that an HTTP navigation completed.
- Check that important content is present when data loads asynchronously.
- Use explicit waits with a bounded timeout.
- Save diagnostic HTML or a second screenshot on failure, but redact secrets before publishing logs.
- Give each parallel job a unique output filename to avoid overwriting another account’s image.
Common failures and fixes
The page is a login screen
The login did not complete, the session expired, or the protected URL redirected. Wait for the post-login marker, inspect the final URL, and confirm that the same driver session performs both login and capture.
Elements cannot be found
The page may still be rendering, the selector may be wrong, or content may be inside an iframe or shadow DOM. Wait for a stable selector, verify the selector manually, and switch into the correct frame when required.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Capybara shows a blank or incomplete page
rack_test does not run a remote browser or JavaScript. Use a Selenium-backed session and ensure the browser and driver are installed in the execution environment.
Headless CI differs from a laptop
Viewport dimensions, fonts, GPU behavior, permissions, and timing can differ. Set an explicit window size, install required fonts, use deterministic waits, and compare screenshots only within a controlled environment.
Login requires MFA or a bot challenge
Do not attempt to bypass a security control. Use an approved test tenant, a documented automation account, or a staging authentication path provided by the site owner. Interactive MFA may require a human-assisted setup.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
The screenshot file is missing or corrupt
Confirm that the directory exists and the process can write to it. Use an absolute path in CI, check the return path and file size, and do not quit the driver before the save call finishes.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Performance, parallelism, and cost
Browser startup and authentication are usually more expensive than the screenshot command itself. Reuse one session for several pages when the account and isolation requirements allow it. For parallel jobs, use separate profiles and accounts where shared cookies could cause races or data leakage. Keep waits bounded so a failed page does not hold a worker indefinitely, and clean up every driver even after exceptions.
Capture only the required viewport or element when a full-page image is unnecessary. This reduces file size and makes visual comparisons easier. Avoid logging page source, cookies, or request headers by default.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server. Its request still needs an authenticated mechanism that the target site accepts; for private pages, use the API’s supported headers or cookies rather than embedding credentials in source code.
For a public or otherwise accessible URL, the one-call form is:
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
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 ScreenshotNeo documentation for authentication-related request options and the other capture parameters. ScreenshotNeo removes cookie-consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Create a free ScreenshotNeo account to try 1,000 screenshots a month without a card.
Capybara or Selenium: which should you choose?
| Need | Better starting point | Reason |
|---|---|---|
| Existing Rails or RSpec system tests | Capybara with Selenium | It fits an established session and assertion style. |
| Low-level browser control | Direct Selenium | You control navigation, waits, windows, cookies, and capabilities directly. |
| Single reusable capture script | Either | Choose based on your team’s existing dependencies and desired abstraction. |
| Full-page output | Driver-dependent | Verify support in the exact browser-driver combination you run. |
Frequently Asked Questions
Can Ruby capture a page after a normal SSO login?
Yes, if the browser driver can complete the authorized SSO flow and retain the resulting cookies or storage. Wait for a signed-in marker before navigating to the protected URL.
Should I save the browser profile in Git?
No. A profile or state file can contain impersonation-capable cookies and headers. Keep it outside version control with restricted access.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteWhy does my screenshot contain the login page?
The authentication signal was checked too early, the session was not reused, or the application redirected after navigation. Assert the final URL and a protected-page element immediately before capture.
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.

