What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To connect Selenium to an already-running Chrome, start a dedicated Chrome process with --remote-debugging-port and a separate --user-data-dir, then set Selenium’s debuggerAddress to the same host and port. The minimal endpoint is usually 127.0.0.1:9222:
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
After Chrome is listening, ChromeDriver can attach to that session instead of launching another browser. This is useful for a manually prepared profile, a browser started by another process, or a remote machine reached through a secure port forward. It also has important command limitations, so use a fresh ChromeDriver-launched session when your test needs commands that depend on ChromeDriver’s automation extension.
What the remote debugging port does
Chrome’s remote debugging port exposes a DevTools endpoint that ChromeDriver can use to find and control an existing browser. The port is not a Selenium server and does not make an ordinary Chrome window attachable retroactively: Chrome must have been launched with remote debugging enabled.
Selenium expects the address in {hostname|IP address}:port form; localhost:9222 is the conventional example (Selenium API reference). Use the same host and port in Chrome’s launch command and Selenium configuration.
PC 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 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
Prepare an isolated Chrome process
Close or isolate the browser you do not want to automate
Chrome normally reuses an existing process and profile. If you launch a debug command against your everyday profile while another Chrome process is open, the new flags may not take effect or the wrong windows may be exposed. Close that browser, or use a dedicated profile directory.
Launch Chrome with a port and profile
On Linux, a complete example is:
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
--user-data-dir gives the debug instance its own cookies, extensions and startup state. Selenium documents it as a Chrome argument, and Chromium’s testing guidance uses a forwarded debugging port for attaching to an existing browser (Selenium Chrome documentation; Chromium testing guidance). Choose a directory that the account running Chrome can read and write. Keep the port bound to a trusted interface; exposing an unauthenticated debugging endpoint to the public internet gives whoever can reach it control of the browser.
On Windows or macOS, use the full path to your Chrome executable if google-chrome is not on PATH, while keeping the two flags unchanged. The profile path must be different from your normal Chrome profile.
Verify that the endpoint exists
If the browser starts successfully, it should listen on the selected port. A connection failure at this stage means Chrome was not started with the expected flag, another process owns the port, the host is wrong, or a firewall is blocking access. Do not change Selenium code until the browser process and endpoint are correct.
Attach Selenium to the running browser
Python example with ChromeOptions
Install Selenium in the environment that will run the test:
python -m pip install -U selenium
Then attach using the experimental option form:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
print(driver.title)
finally:
driver.quit()
The current Python bindings also support the equivalent property:
Rank #2
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.debugger_address = "127.0.0.1:9222"
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
finally:
driver.quit()
Both forms set the address of the remote DevTools instance (Selenium Python API source). Replace 127.0.0.1:9222 only when Chrome is listening on another host or forwarded port.
Choose the intended tab
An existing profile can contain several tabs. Selenium attaches to the browser session, but your script may need to select a particular window:
handles = driver.window_handles
for handle in handles:
driver.switch_to.window(handle)
if "example.com" in driver.current_url:
break
If no matching tab exists, navigate with driver.get() or create a new tab using Selenium’s window APIs.
Attach versus let ChromeDriver launch Chrome
With debuggerAddress, the browser keeps its existing profile, cookies, tabs and manually prepared state. The trade-off is that ChromeDriver did not load its automation extension when Chrome originally started. ChromeDriver documents that some WebDriver commands, including browser-window resizing, require that extension (ChromeDriver help).
Therefore, remote debugging is best for controlling a prepared session, not as a universal replacement for normal WebDriver startup. If a command fails with operation not supported when using remote debugging, remove debuggerAddress and allow webdriver.Chrome() to launch a new browser. ChromeDriver’s guidance explicitly recommends rewriting the test to launch a new session for this error (ChromeDriver documentation).
Use a fresh session when you need full WebDriver support
from selenium import webdriver
# No debuggerAddress: ChromeDriver creates the browser and loads its automation support.
driver = webdriver.Chrome()
try:
driver.set_window_size(1280, 900)
driver.get("https://example.com")
finally:
driver.quit()
This loses the already-open profile state. If you need repeatable cookies or extensions, configure them in a ChromeDriver-launched profile instead of attaching to a human-owned window.
Free tools Windows power users keep installed
One-click scans. No signup required.
Port mode is different from pipe mode
--remote-debugging-port=9222 is a TCP endpoint intended for the attach workflow above. Selenium’s Chromium options also describe --remote-debugging-pipe, which connects Chrome and ChromeDriver through a pipe. Pipe mode is a separate launch configuration: it is not another value for debuggerAddress, and it does not attach to an already-running browser at 127.0.0.1:9222 (Selenium Chromium options). Use one model consistently: a port for an existing process, or a pipe when ChromeDriver launches the process.
Version and compatibility checks
ChromeDriver and Chrome must have matching major versions. Selenium notes that a mismatch causes the driver to error (Selenium troubleshooting documentation). Check the browser’s About page or command-line version output, then install or select a ChromeDriver with the same major version. A correct port cannot compensate for an incompatible driver.
- Confirm the debug Chrome process is the one whose version you checked.
- Confirm Selenium is using the intended ChromeDriver binary or Selenium Manager result.
- After upgrading Chrome, repeat the major-version check before diagnosing the port.
Remote machines and port forwarding
If Chrome runs on another machine, do not blindly bind its debugging port to a public network interface. Prefer an authenticated tunnel or SSH port forward, then point Selenium at the local end of that forward. Chromium’s testing guide demonstrates the same arrangement with a forwarded PORT (Chromium testing guidance).
For example, once a secure tunnel maps the remote port to local port 9222, Selenium still uses:
options.debugger_address = "127.0.0.1:9222"
If you intentionally use a reachable remote host instead, set debugger_address to that host and port and protect the endpoint with network controls. The address must describe where the DevTools server is reachable from the Selenium process, not necessarily the browser’s own loopback name.
Troubleshooting remote debugging
“Cannot connect” or connection refused
- Make sure Chrome was launched with
--remote-debugging-port=9222, not merely opened normally. - Make sure
debuggerAddressuses the identical port and the correct host, commonly127.0.0.1orlocalhost. - Check whether another process already owns the port; choose a free port and restart both Chrome and Selenium.
- For a remote browser, verify the tunnel, firewall and bind address.
The normal Chrome window opens instead
Chrome likely reused an already-running profile process. Close it and relaunch with a distinct --user-data-dir. A separate profile prevents process and lock-file collisions.
Rank #4
ChromeDriver reports a version error
Compare Chrome and ChromeDriver major versions first. Update or select the matching driver, then retry the same attach command.
“Operation not supported when using remote debugging”
The requested WebDriver command probably depends on ChromeDriver’s automation extension, which was not loaded at the original Chrome startup. Remove debuggerAddress and run a fresh ChromeDriver-launched session, as ChromeDriver recommends (ChromeDriver help).
The script controls the wrong tab
Enumerate driver.window_handles, switch through each handle and match driver.current_url or the title. Existing sessions commonly contain multiple tabs.
The port works locally but not in a container or VM
127.0.0.1 refers to the network namespace containing Selenium. If Chrome and Selenium are in different containers or virtual machines, expose or forward the port securely and use the endpoint visible from the Selenium environment.
Operational guidance
Reliability
Start the dedicated Chrome process before the test and keep its profile directory stable for the life of that process. Treat the browser as shared state: another user or process can change tabs, navigate, or close windows while Selenium is attached. For deterministic CI runs, a fresh ChromeDriver-launched session is usually safer.
Security
A remote debugging endpoint is powerful control, not a read-only status port. Keep it on loopback where possible, use authenticated tunneling for remote access, and never publish an unprotected debugging port on a shared or public network.
Performance
Attaching avoids the startup and profile-setup work of a new browser, but it does not remove page-load, JavaScript or network variability. Reusing a busy interactive profile can be less predictable than creating a clean session for each test.
Or skip the browser setup
If your goal is a clean image or PDF rather than interactive control of an existing Chrome window, ScreenshotNeo provides a single HTTP request. Its capture flow accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before the shot; each step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status.
Use the API documentation for all options at https://screenshotneo.com/docs/. A cURL request is:
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)
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}`);
ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. Features include full-page and element capture, device and viewport settings, retina scale, dark mode, PDF paper and page controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture for up to 100 URLs per call, usage reporting and an OpenAPI specification. Existing parameter names used by other screenshot APIs also work.
Recommended Free Tools
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free. Create a free ScreenshotNeo account to get started.
Frequently Asked Questions
Can I attach Selenium to Chrome without closing my personal browser?
Yes, if you launch a separate Chrome process with its own --user-data-dir and debugging port. Do not rely on your normal profile being reusable while another Chrome process owns it.
What should I enter for debuggerAddress?
Enter the host and port where the DevTools endpoint is reachable from Selenium, such as 127.0.0.1:9222 or localhost:9222.
Does remote debugging preserve my logged-in state?
It preserves the cookies and profile state of the Chrome process you started, provided you attach to that process and its dedicated profile.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteQuick 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.

