What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

You can inspect a Selenium-controlled, headless Chrome session by launching Chrome with a headless flag and --remote-debugging-port, then connecting to the port Chrome reports from another Chrome window. The safest general setup is Selenium’s Ruby bindings with --headless=new (or the spelling supported by your installed Chrome) and --remote-debugging-port=0. Port zero lets Chrome choose an unused port, avoiding collisions.

What remote debugging does

Remote debugging exposes Chrome’s DevTools Protocol endpoint while your Ruby WebDriver process keeps the browser alive. A second, regular Chrome instance can then open DevTools for the same page: inspect the DOM, run JavaScript, view console errors, examine network requests, and check storage and layout just as you would with a visible browser.

Headless mode changes how Chrome renders its window, not the basic debugging protocol. Selenium still owns the session, so do not call driver.quit until you finish inspecting it.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This guide uses the official Selenium Chrome options API and Chrome’s documented headless-debugging flow. Check the exact Chrome release deployed in your environment before choosing an argument spelling.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Prerequisites and version checks

  • Ruby and the selenium-webdriver gem.
  • Google Chrome (or a Chromium build) installed where the Ruby process runs.
  • ChromeDriver available to Selenium, either through Selenium Manager or your own driver installation.
  • A separate regular Chrome installation for chrome://inspect.

Selenium’s Chrome documentation says Selenium 4 is compatible with Chrome 75 and newer, and that Chrome and ChromeDriver must match in major version. Treat that as a compatibility requirement, not as a guarantee that every minor release behaves identically. See Selenium’s Chrome documentation for current setup details.

Install the Ruby binding

Add the gem to your project:

gem install selenium-webdriver

In a Bundler project, add this line to your Gemfile and run bundle install:

gem "selenium-webdriver"

Verify the browser and driver major versions before debugging. A mismatch commonly appears as a session-creation or “only supports Chrome version …” error; fix the versions first instead of changing debugging flags.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Launch headless Chrome with an automatically selected port

The following complete Ruby program starts Chrome, enables remote debugging, navigates to a page, and waits so you can attach. Save it as debug_headless.rb:

require "selenium-webdriver"

options = Selenium::WebDriver::Chrome::Options.new
options.add_argument("--headless=new")
options.add_argument("--remote-debugging-port=0")

# Add this only when your environment needs a dedicated profile:
# options.add_argument("--user-data-dir=/tmp/selenium-debug-profile")

driver = Selenium::WebDriver.for(:chrome, options: options)

begin
  driver.navigate.to("https://example.com")
  puts "The session is running. Read Chrome's reported DevTools endpoint, then inspect it."
  puts "Press Enter here after you finish debugging."
  STDIN.gets
ensure
  driver.quit
end

The --headless=new spelling is commonly shown by Selenium. Chrome’s official material also demonstrates --headless; if your installed release rejects the newer spelling, use the form supported by that release. The important debugging flag is --remote-debugging-port.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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

Find the DevTools endpoint

Read Chrome’s reported port

With --remote-debugging-port=0, Chrome chooses an available port. Chrome reports the selected endpoint to standard error and writes the port to a DevToolsActivePort file inside the browser profile directory. Do not assume that the port is 9222.

Capture the process output if your test runner hides standard error. If you supplied a custom --user-data-dir, look for DevToolsActivePort beneath that directory. Without a custom profile, Selenium or Chrome may create a temporary profile; inspect the startup log or process arguments to identify its location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a fixed port when you need a predictable address

Replace the automatic setting with:

options.add_argument("--remote-debugging-port=9222")

A fixed port is convenient for scripts and team instructions, but another process may already be using it. If Chrome cannot bind the port, choose a different unused value. A fixed endpoint can be checked at http://localhost:9222/json/version; the DevTools Protocol reference documents the webSocketDebuggerUrl returned by that endpoint. See the Chrome DevTools Protocol reference.

Connect from a regular Chrome window

  1. Leave the Ruby program running and the WebDriver session open.
  2. Open a normal (non-headless) Chrome window.
  3. Enter chrome://inspect in the address bar.
  4. Choose Configure… under “Discover network targets.”
  5. Add the host and port Chrome reported, normally localhost:<port>. For a browser running in another container or machine, use an address reachable from the inspecting Chrome and ensure the port is exposed safely.
  6. Return to the “Remote Target” list and select the page. Click inspect to open DevTools.

Chrome’s guidance on connecting to local servers and instances is available at Chrome for Developers’ port-forwarding documentation. A remote endpoint is powerful: bind it only where trusted clients can reach it, and avoid exposing a debugging port directly to the public internet.

Inspecting and debugging a live Selenium page

DOM, styles, and layout

Use the Elements panel to inspect the post-Selenium DOM, including content inserted by JavaScript. Changes made in DevTools are temporary and do not alter your Ruby source or the deployed site.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

Console and JavaScript state

The Console shows browser errors and lets you evaluate expressions in the page context. This is useful for confirming that a click handler ran, checking computed values, or testing a selector before putting it into an explicit wait.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Network and storage

The Network panel reveals redirects, failed requests, response status, and timing. Application panels expose cookies, local storage, and service-worker state. These observations describe the current session; a new Selenium run may have a different profile unless you deliberately reuse one.

Keep the session inspectable

A test that exits immediately closes Chrome before you can attach. Use a controlled pause, a debugger breakpoint, or a test-runner wait. The ensure block in the example guarantees cleanup when you press Enter or an exception occurs. In CI, add an explicit diagnostic mode rather than an infinite sleep, so failed jobs do not consume workers indefinitely.

Common failures and fixes

ChromeDriver says the browser version is unsupported

Cause: Chrome and ChromeDriver have different major versions. Fix: install a driver matching Chrome’s major version, update Chrome, or let a current Selenium Manager resolve the driver. Confirm both versions from their command-line version output and rerun without debugging flags first.

“Address already in use” or Chrome exits immediately

Cause: a fixed port is occupied, or a stale profile is locked. Fix: switch to --remote-debugging-port=0, select another fixed port, and use a unique temporary --user-data-dir for parallel sessions. Remove abandoned temporary profiles only after their Chrome processes have stopped.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

No target appears in chrome://inspect

Cause: the wrong host or port was entered, Chrome has already exited, or a container firewall prevents access. Fix: read the current DevToolsActivePort value or startup log, verify the Ruby process is still alive, and test the endpoint locally. For a fixed port, request /json/version and confirm it returns a WebSocket URL.

The DevToolsActivePort file cannot be found

Cause: you are looking in the wrong profile, Chrome failed before creating the file, or the temporary directory was removed. Fix: provide an explicit writable --user-data-dir, check permissions, and inspect standard error for startup failures. The file is created in the active browser profile, not necessarily in your normal Chrome profile.

Headless Chrome fails in Linux or a container

Cause: insufficient shared memory, sandbox restrictions, missing libraries, or an unwritable profile directory. Fix: install Chrome’s runtime dependencies, allocate adequate /dev/shm, choose a writable user-data directory, and apply container-specific sandbox settings only according to your security policy. Do not add flags such as --no-sandbox automatically; they reduce isolation and should be a deliberate environment decision.

The page is blank or not ready when DevTools opens

Cause: navigation or application JavaScript is still in progress. Fix: wait for a meaningful selector or document state in Selenium before pausing. DevTools can inspect the current state, but it does not make the test wait for your application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Automatic versus fixed ports

Choice Advantages Trade-offs
--remote-debugging-port=0 Avoids selecting a port that another process already uses; safer for parallel runs. You must read Chrome’s reported port or DevToolsActivePort file.
--remote-debugging-port=9222 (or another fixed value) Easy to document and address from scripts. Can collide with another Chrome process and requires careful cleanup.

For one-off interactive debugging, automatic allocation is usually the least fragile choice. For a controlled local tool that always discovers the endpoint, a fixed port can be reasonable.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Attaching to an existing browser

The Selenium Ruby API exposes a Chromium debugger_address option. It is relevant when Chrome was started separately with remote debugging and Selenium is asked to connect to it. Attach-mode behavior depends on the exact Selenium gem, ChromeDriver, profile, and browser versions, so validate it in your environment before making it the foundation of a test suite. The option is documented in the Selenium Ruby Chromium options API. Launching Chrome through Selenium, as shown above, keeps ownership and cleanup straightforward.

Performance, reliability, and security notes

  • Headless mode avoids window-display overhead, but DevTools inspection itself adds a debugging client; do not use an attached interactive session as a benchmark run.
  • Port zero is friendlier to parallel tests. Give each run its own profile and ensure your endpoint-discovery code associates the right port with the right process.
  • Use explicit waits for application conditions instead of arbitrary long sleeps. A pause intended for a human should be enabled only in a diagnostic mode.
  • Keep Chrome and driver versions synchronized through your build image or dependency-management process.
  • Remote debugging grants extensive control over the browser. Keep the listener on localhost or a protected network, and shut down the session after diagnosis.

Or skip the browser setup

If your actual goal is a clean image or PDF of a page rather than interactive inspection, ScreenshotNeo makes one HTTP request and returns the result. 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. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

See the ScreenshotNeo documentation for all options. A basic call looks like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://stripe.com 
  -o shot.webp

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)

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(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo includes full-page and selector captures, device presets and custom viewports, retina scale, dark mode, PDF controls, custom CSS and JavaScript, clicks and waits, request blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed image links, asynchronous webhooks, bulk capture for up to 100 URLs per call, usage reporting, and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots, and every feature is available on every plan. Create a free ScreenshotNeo account.

Further official references

Frequently Asked Questions

How do I enable remote debugging in headless Chrome?

Pass --remote-debugging-port=0 together with a supported headless argument when Selenium creates Chrome, then read the reported port and connect through chrome://inspect.

Can I connect to Chrome on port 9222?

Yes. Launch with --remote-debugging-port=9222, add localhost:9222 in chrome://inspect, and verify the endpoint at http://localhost:9222/json/version.

Where is DevToolsActivePort?

It is in the active Chrome user-data directory. Supply an explicit writable --user-data-dir when you need a predictable location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Bottom Line

Launch Selenium’s Chrome with a supported headless flag and remote debugging enabled, discover the port Chrome actually chose, and attach from chrome://inspect while the Ruby session remains alive.

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.