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
9222
to 9223
- no effect9222
- no effectThe 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
chrome://inspect/
, but didn't found any webSocketDebuggerUrl
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:
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:
Use other Chromium-based browsers such as Edge and Opera, which I, for one, didn't find too hot personally.
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.
In the following instruction, make sure to customize your user name
and %USERPROFILE%\AppData\Chrome for CDP
to your needs/liking.
%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
).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:
regedit
, navigate to the HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command
path and export the Default data to a file as a backup."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.Naturally, you'll have to sign in to websites again. FWIW, I went with this Option 3.