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: