From 8cc4a289a063b94aa936017980c0e4529202d2c6 Mon Sep 17 00:00:00 2001 From: Jovenkemp <128696682+Jovenkemp@users.noreply.github.com> Date: Fri, 12 Jun 2026 12:03:49 +1000 Subject: [PATCH] Fix MS Store dialog when opening chrome://inspect on Windows webbrowser.open() on Windows hands the URL to ShellExecute, which has no protocol handler registered for the chrome:// scheme, so every failed daemon attach pops a "You'll need a new app to open this chrome link" Microsoft Store dialog instead of opening the inspect page. Locate chrome.exe in the three standard install locations and pass the URL as a process argument instead; Chrome forwards it to the running instance as a new tab. Falls back to webbrowser.open() when Chrome isn't found in any of them. Co-Authored-By: Claude Fable 5 --- src/browser_harness/admin.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/browser_harness/admin.py b/src/browser_harness/admin.py index c72a8fb3..01454178 100644 --- a/src/browser_harness/admin.py +++ b/src/browser_harness/admin.py @@ -730,6 +730,20 @@ def _open_chrome_inspect(): return except Exception: pass + if platform.system() == "Windows": + # ShellExecute can't resolve chrome:// URIs (no protocol handler -> MS Store + # dialog); pass the URL as an argument to the Chrome binary instead. + for chrome in ( + os.path.expandvars(r"%ProgramFiles%\Google\Chrome\Application\chrome.exe"), + os.path.expandvars(r"%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe"), + os.path.expandvars(r"%LocalAppData%\Google\Chrome\Application\chrome.exe"), + ): + if os.path.exists(chrome): + try: + subprocess.Popen([chrome, url]) + return + except Exception: + pass try: webbrowser.open(url, new=2) except Exception: