fix(admin): spawn chrome.exe directly on Windows for chrome:// inspect URL (#290)#295
Open
voidborne-d wants to merge 1 commit intobrowser-use:mainfrom
Open
fix(admin): spawn chrome.exe directly on Windows for chrome:// inspect URL (#290)#295voidborne-d wants to merge 1 commit intobrowser-use:mainfrom
voidborne-d wants to merge 1 commit intobrowser-use:mainfrom
Conversation
…t URL (browser-use#290) webbrowser.open("chrome://inspect/...") on Windows routes through ShellExecute, which has no registered handler for the chrome:// scheme. Instead of opening the page in Chrome, Windows shows a "Get an app to open this" dialog and the setup flow stalls waiting for the user to click Allow on a tab that never opened. Match the existing macOS branch's intent (talk to Chrome directly) by walking the standard Chrome install locations on Windows and spawning chrome.exe with the URL as a command-line argument. Fall through to the pre-existing webbrowser.open path when no Chrome binary is found, so Linux behaviour is unchanged. Tests cover both the chrome.exe-found path and the no-chrome-found fallback under a Windows platform mock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #290.
Bug
webbrowser.open(\"chrome://inspect/...\")on Windows routes throughShellExecute, which has no registered handler for thechrome://scheme. Instead of opening Chrome to the inspect page, Windows pops a "Get an app to open this" Microsoft Store dialog — the setup flow then sits in its retry loop waiting for the user to click Allow on a tab that never opened._open_chrome_inspect()already detects macOS and bypasseswebbrowser.openvia AppleScript for the same reason. Windows had no equivalent branch and fell through to the brokenwebbrowser.open(url, new=2)call.Fix
Match the macOS branch's intent — talk to Chrome directly. Walk the standard Chrome install locations on Windows (
%PROGRAMFILES%,%PROGRAMFILES(X86)%,%LOCALAPPDATA%) and spawnchrome.exewith the URL as a command-line argument. If no Chrome binary is found, fall through to the pre-existingwebbrowser.openpath so behaviour on Linux (and headless Windows installs) is unchanged.Why this shape
chrome://settings/help, Selenium, Playwright, etc.).chrome://...; ifchrome.exeisn't installed the user wouldn't be at the inspect page anyway. Keeping the diff narrow.Tests
tests/unit/test_admin.py:test_open_chrome_inspect_invokes_chrome_exe_directly_on_windows— under a Windows mock with a fakechrome.exeon%PROGRAMFILES%, assertssubprocess.Popenis called with[chrome.exe, \"chrome://inspect/#remote-debugging\"]andwebbrowser.openis not called.test_open_chrome_inspect_falls_back_to_webbrowser_when_no_chrome_exe_on_windows— under a Windows mock with no env vars set, asserts the pre-existingwebbrowser.openfallback still runs (so users on unusual Chrome installs get the same behaviour they had before).Reverting just the
admin.pychange with the new tests in place fails the first test (red), confirming the test catches the bug. Full suite:42 passed.Test plan
pytest tests/unit/— 42/42 passbrowser-harness --setupwith a fresh Chrome profile and remote-debugging disabled — should openchrome://inspect/#remote-debuggingdirectly in Chrome instead of the Microsoft Store dialog (I can't test this myself; would appreciate a Windows reviewer).AI disclosure
Implementation drafted with Claude Code assistance. Bug was filed by @Wievondii in #290 with a proposed fix; this PR applies that proposal with platform-native env-var lookup, a graceful fallback, and unit-test coverage.
Summary by cubic
Fixes opening chrome://inspect on Windows by launching Chrome directly instead of using
webbrowser. This avoids the Microsoft Store dialog and unblocks the setup flow. Closes #290.chrome.exewith the URL; fall back towebbrowser.openif Chrome isn’t found.chrome.exepath and the fallback.Written for commit b063452. Summary will update on new commits.