Skip to content

fix(daemon): open inspect in the user's running browser, not always Chrome (#425)#471

Open
ahmadalzaro1 wants to merge 1 commit into
browser-use:mainfrom
ahmadalzaro1:fix/browser-agnostic-inspect
Open

fix(daemon): open inspect in the user's running browser, not always Chrome (#425)#471
ahmadalzaro1 wants to merge 1 commit into
browser-use:mainfrom
ahmadalzaro1:fix/browser-agnostic-inspect

Conversation

@ahmadalzaro1

@ahmadalzaro1 ahmadalzaro1 commented Jun 24, 2026

Copy link
Copy Markdown

Addresses #425 (the hardcoded-Chrome recovery).

Problem

_open_chrome_inspect() (admin.py) hardcoded tell application "Google Chrome" on macOS. So a user whose daily browser is a non-Chrome Chromium — Dia, Arc, Edge, Brave — got Google Chrome force-opened on chrome://inspect/#remote-debugging on every cold harness invocation. Worse, per the issue: if Chrome's inspect checkbox happened to still be ticked, that freshly launched Chrome wrote a live DevToolsActivePort and the agent then silently automated Chrome (without the user's logins) instead of their actual browser.

Fix

Detect the running Chromium browser via ps (_running_chromium_app) and drive that one in the AppleScript, using the correct inspect scheme (edge:// for Edge, chrome:// otherwise). Falls back to Google Chrome when nothing matches; off macOS keeps the generic webbrowser path. Mirrors the multi-browser name list already used by _chrome_running().

Scope note (the issue describes two bugs)

  • Bug 1 (discovery stops at the first stale DevToolsActivePort): already mitigated on current mainget_ws_url()'s per-profile loop now catches OSError on a dead port and advances to the next profile rather than raising. I verified this against a real machine: a stale dead-port Chrome file no longer shadows a healthy browser.
  • Bug 2 (recovery force-opens Google Chrome): fixed here.

Tests

New tests/unit/test_open_chrome_inspect.py (6): prefers a running non-Chrome browser, Edge → edge:// scheme, fallback to Chrome, None off macOS, and _open_chrome_inspect drives the detected app (Dia/Edge) not Chrome. Existing test_admin.py (39) still green.


Summary by cubic

Open the remote‑debugging inspector in the user's running Chromium browser on macOS (Dia, Arc, Edge, Brave, etc.) instead of always launching Google Chrome. Prevents unintended Chrome automation and uses the correct edge:// scheme for Edge. Addresses #425.

  • Bug Fixes
    • Detect the running Chromium app via ps and open <scheme>://inspect/#remote-debugging in that app through AppleScript; fall back to Google Chrome when none is running. Non‑macOS keeps the generic webbrowser path.
    • Support Microsoft Edge’s edge:// inspector; others use chrome://.

Written for commit 4f72853. Summary will update on new commits.

Review in cubic

…hrome

Issue browser-use#425. The remote-debugging recovery (_open_chrome_inspect) hardcoded
`tell application "Google Chrome"` on macOS, so users whose daily browser is a
non-Chrome Chromium (Dia/Arc/Edge/Brave) had Google Chrome force-opened on
chrome://inspect every cold invocation — and if Chrome's inspect checkbox was
still ticked, the agent ended up silently automating a fresh Chrome (without the
user's logins) instead of their actual browser.

Detect the running Chromium browser via ps and drive THAT one
(_running_chromium_app), with the correct inspect scheme (edge:// for Edge,
chrome:// otherwise). Falls back to Google Chrome when nothing matches; off
macOS keeps the generic webbrowser path.

Addresses browser-use#425.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant