google-chromegoogle-chrome-devtoolspuppeteerpuppeteer-sharp

Is Chrome /json/version feature deprecated?


I used to debug Chrome with PuppeteerSharp. For that, I run Chrome with command:

"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --profile-directory="Default"

Then I wait Chrome t start and make GET request to http://127.0.0.1:9222/json/version to get webSocketDebuggerUrl value, thich I pass to

_browser = await Puppeteer.ConnectAsync(new() 
{ 
    BrowserWSEndpoint = webSocketDebuggerUrl, // value got from Chrome /json/version
});

And that works fine for a year until today. Now if I request http://127.0.0.1:9222/json/version, it gives me ERR_CONNECTION_REFUSED

What I tried is to

The Chrome version I got is 136.0.7103.49 (Official Build) (64-bit) - latest at the moment

Then I push my other PC, which got at moment Chrome 134...., started Chrome with --remote-debugging-port=9222 and it works. Then I decided to update chrome to latest and it breaks...

So my question is did something changed for chrome remote debugging in latest releases? How now should I start Chrome to debug, how should I get webSocketDebuggerUrl value? Or most likely there is some new settings had to be set to allow get that value

Some similar struggles from before

Here is also different approach to gain that value, but it looks way too comlex

Have to mention it also not available from chrome://version/

I have found a workaround, but not a solution:


Solution

  • Cause

    Back in Mar. '25, an article was posted on Chrome for Developers, stating Google would disable Chrome DevTools Protocol connections for the default data directory, starting from Chrome 136.

    As of now, there are 3 alternative solutions/workarounds at our disposal as follows:

    Option 1

    Use other Chromium-based browsers such as Edge and Opera, which I, for one, didn't find too hot personally.

    Option 2

    Use Chrome for Testing, which is spared from the above breaking change for now. This policy, however, is at the mercy and whim of Google and may or may not change further down the road.

    Option 3

    In the following instruction, make sure to customize your user name and %USERPROFILE%\AppData\Chrome for CDP to your needs/liking.

    1. Close all Chrome windows and use Task Manager to make sure no Chrome processes are running.
    2. Copy or move the %LOCALAPPDATA%\Google\Chrome\User Data folder to another location with no possible permission issues, e.g., %USERPROFILE%\AppData\Chrome for CDP (or C:\Users\your user name\AppData\Local\Google\Chrome).
    3. Right-click and access the Properties of all Chrome links, esp. the one on your taskbar, to change the Target command line to, e.g., %ProgramW6432%\Google\Chrome\Application\chrome.exe --user-data-dir="%USERPROFILE%\AppData\Chrome for CDP\User Data" --remote-debugging-port=9222.

    To ensure this custom profile be used when opening .url files:

    1. Press Win+R to run regedit, navigate to the HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command path and export the Default data to a file as a backup.
    2. Change the Default data to, e.g., "C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir="C:\Users\your user name\AppData\Chrome for CDP\User Data" --remote-debugging-port=9222 --single-argument %1. Note that the percent notation for paths (environment variable expansion) won't work here.
    3. All done and you're back to business as usual!

    Naturally, you'll have to sign in to websites again. FWIW, I went with this Option 3.