Skip to content

open command mangles chrome-extension:// URLs by auto-upgrading to HTTPS #409

@rsiddle

Description

@rsiddle

When using agent-browser open with a chrome-extension:// URL, the scheme is silently rewritten to https://chrome-extension//... (colon stripped, scheme upgraded), causing ERR_NAME_NOT_RESOLVED.

This prevents navigating to extension pages (popup, side panel, options) which is a core requirement for Chrome extension testing.

Reproduction

# Load an extension and try to navigate to its page
agent-browser \
  --extension /path/to/unpacked/extension \
  --session test \
  --headed \
  open "chrome-extension://abcdefghijklmnop/popup.html"

Expected: Browser navigates to chrome-extension://abcdefghijklmnop/popup.html

Actual:
✗ page.goto: net::ERR_NAME_NOT_RESOLVED at https://chrome-extension//abcdefghijklmnop/popup.html

The :// is stripped and the URL is upgraded to https://, producing an invalid URL.

Workarounds attempted

Method Result
agent-browser open chrome-extension://... Rewritten to https://chrome-extension//...
agent-browser tab new chrome-extension://... ERR_BLOCKED_BY_CLIENT
agent-browser eval "location.href = 'chrome-extension://...'" ERR_BLOCKED_BY_CLIENT
agent-browser eval "window.open('chrome-extension://...')" Tab created but shows chrome-error://chromewebdata/

None of the agent-browser commands can navigate to chrome-extension:// URLs.

Working Playwright approach

Using Playwright directly (which agent-browser wraps) works perfectly:

  const { chromium } = require('playwright');

  const context = await chromium.launchPersistentContext('/tmp/test', {
    args: [
      `--disable-extensions-except=${extPath}`,
      `--load-extension=${extPath}`,
    ],
  });

  let sw = context.serviceWorkers()[0];
  if (!sw) sw = await context.waitForEvent('serviceworker');
  const extensionId = sw.url().split('/')[2];

  const page = context.pages()[0];
  await page.goto(`chrome-extension://${extensionId}/popup.html`); // Works!

Reference: https://playwright.dev/docs/chrome-extensions

This confirms the issue is in agent-browser's URL processing, not a Playwright or Chromium limitation.

Suggested fix

Skip the HTTPS auto-upgrade for URLs with the chrome-extension:// scheme. These are legitimate navigation targets when --extension is used and should be passed through to Playwright's page.goto() unmodified.

Similarly, chrome:// URLs (e.g., chrome://extensions) are also affected by the upgrade logic and could be preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions