"Existing" is the catch. Chrome only listens for DevTools Protocol clients if it was started with a debugging port, so the Chrome you opened this morning from the Dock has nothing to attach to. To connect to an existing Chrome with CDP, you start a Chrome that listens, then connect to it as many times as you like while it runs.
Step 1: start Chrome with a debugging port
Quit Chrome first. If it is still running, a second launch with the flags hands its command line to the open browser and quits, and no port appears.
On a Mac:
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
--remote-debugging-port=9222 \
--user-data-dir="$HOME/chrome-cdp"
On Windows:
"C:\Program Files\Google\Chrome\Application\chrome.exe" ^
--remote-debugging-port=9222 ^
--user-data-dir=C:\chrome-cdp
The --user-data-dir is not optional any more. Google's Chrome blog says that from Chrome 136 the debugging switches "will no longer be respected if attempting to debug the default Chrome data directory" and must be "accompanied by the --user-data-dir switch to point to a non-standard directory" (Chrome for Developers, published 17 March 2025, read 2 November 2026). The reason it gives is that infostealers had taken to using the port to extract cookies. So you cannot attach to your everyday profile; you get a separate one, and you sign in to whatever the script needs inside it.
Step 2: find the WebSocket address
With the port open, Chrome serves a few HTTP endpoints on it. The DevTools Protocol documentation (read 2 November 2026) lists them:
http://127.0.0.1:9222/json/versionreturns version details andwebSocketDebuggerUrl, the browser-level socket.http://127.0.0.1:9222/json/listlists the tabs, workers and other targets, each with its own socket./devtools/browser/<id>is the browser socket;/devtools/page/<id>talks to one tab.
Open /json/version in another browser or with curl. If it answers, Chrome is listening.
Everything the window does, from a script on your own computerIn Mosaic: REST API. Everything the window does, from your own scripts. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.
Mosaic is a desktop app
Email yourself the link and open it on your computer.
Step 3: connect to the existing Chrome with CDP
Playwright takes either address. Its documentation shows connectOverCDP('http://localhost:9222') and then browser.contexts()[0] for the default context (Playwright docs, read 2 November 2026):
const browser = await chromium.connectOverCDP('http://127.0.0.1:9222')
const context = browser.contexts()[0]
const page = context.pages()[0]
Puppeteer takes browserURL for the HTTP address or browserWSEndpoint for the socket (Puppeteer docs, read 2 November 2026):
const browser = await puppeteer.connect({ browserURL: 'http://127.0.0.1:9222', defaultViewport: null })
With no library at all, read /json/list, pick a target whose type is page, open a WebSocket to its webSocketDebuggerUrl and send JSON messages such as {"id":1,"method":"Page.navigate","params":{"url":"https://example.com"}}.
More than one client can be attached at once. The protocol documentation says Chrome 63 introduced support for multiple simultaneous clients, so your script and the DevTools window can watch the same tab.
Pick a fixed port, not 0
--remote-debugging-port=0 lets Chrome choose a free port and write it to a DevToolsActivePort file in the profile folder. It has a cost a page can read: MDN lists the --remote-debugging-port flag "specifying port 0" among the cases in which Chrome sets navigator.webdriver to true (MDN, read 2 November 2026). A fixed port leaves it alone.
When something does not connect
Three failures cover most of what goes wrong. If /json/version does not answer at all, Chrome did not take the flag: either another Chrome was already running and swallowed the launch, or the switch was given without --user-data-dir on Chrome 136 or later. Quit every Chrome window and launch again.
If /json/version answers but the client times out, check the address. Chrome listens on 127.0.0.1, and on some machines localhost resolves to the IPv6 address first, which nothing is listening on. Writing 127.0.0.1 in full removes the guess.
If the client connects and sees no pages, it attached to the browser target and the window has no tab yet. Open one from the script, or point a raw WebSocket at a target from /json/list instead of the browser socket.
What a site can still see
Connecting over CDP does not hide that a script is driving. The browser is your own machine with its own fingerprint and your own IP address. And Puppeteer and Playwright rely on the DevTools command Runtime.Enable, which the rebrowser project documents pages detecting (the project's write-up on GitHub, read 2 November 2026). On our engine we measured that one call flipping deviceandbrowserinfo's verdict from isBot=false to isBot=true, while Page.enable and Input.dispatchKeyEvent left it alone.
The same thing for many profiles in Mosaic
In Mosaic you never pass the flags yourself. POST /profiles/:id/start on the local REST API launches the profile with its own data folder, fingerprint, proxy and cookies, picks a free port for it, and returns both debugPort and wsEndpoint. Each running profile has its own port, so ten profiles are ten separate CDP endpoints. /json/list on that port works exactly as above.

The attach steps for each library, and the defaults to switch off, are in using Playwright with an anti-detect browser and the Puppeteer version. What the rest of Mosaic's local API offers is in the local API explainer. It is part of Pro, $25 a month, charged at checkout.
Sources
- Chrome for Developers: Changes to remote debugging switches to improve security, read November 2, 2026
- Chrome DevTools Protocol documentation, read November 2, 2026
- Playwright docs: BrowserType.connectOverCDP, read November 2, 2026
- Puppeteer docs: ConnectOptions, read November 2, 2026
- rebrowser-patches: Runtime.Enable leak (GitHub), read November 2, 2026
- MDN: Navigator.webdriver, read November 2, 2026






