Skip to content

feat: expose Playwright launch params in BrowserConfig (#1820)#1876

Open
hafezparast wants to merge 1 commit intounclecode:developfrom
hafezparast:feat/maysam-playwright-launch-params-1820
Open

feat: expose Playwright launch params in BrowserConfig (#1820)#1876
hafezparast wants to merge 1 commit intounclecode:developfrom
hafezparast:feat/maysam-playwright-launch-params-1820

Conversation

@hafezparast
Copy link
Copy Markdown
Contributor

Summary

  • Adds 4 new params to BrowserConfig for custom browser binary support
  • All defaults unchanged — fully backward compatible
  • Addresses all 6 items from the feature request (2 were already done)

Closes discussion #1820

New Parameters

Param Type Default Purpose
executable_path str None Path to custom Chromium binary
ignore_default_args list None Playwright flags to exclude from launch
skip_default_browser_args bool False Skip all hardcoded args, use only extra_args
skip_default_headers bool False Skip forced User-Agent/sec-ch-ua overrides

Usage

# Custom stealth binary — full control
config = BrowserConfig(
    executable_path="/usr/bin/brave-browser",
    skip_default_browser_args=True,
    skip_default_headers=True,
    extra_args=["--window-size=1920,1080"],
)

Already covered (no changes needed)

Test plan

  • All 4 params default correctly (None/False)
  • Explicit param setting works
  • to_dict() / load() roundtrip preserves all params
  • clone() preserves and overrides correctly
  • _build_browser_args(): default includes hardcoded args
  • _build_browser_args(): skip_default_browser_args=True → only extra_args
  • _build_browser_args(): executable_path / ignore_default_args passed to launch dict
  • ManagedBrowser.build_browser_flags(): same skip logic works
  • setup_context(): default sets User-Agent headers
  • setup_context(): skip_default_headers=True skips UA override
  • setup_context(): custom headers still work with skip
  • Regression: 58 passed, 5 skipped across 3 test suites

🤖 Generated with Claude Code

Add 4 new params to BrowserConfig for users with custom browser binaries:
- executable_path: path to custom Chromium binary (Brave, ungoogled-chromium, etc.)
- ignore_default_args: list of default Chromium flags to exclude from launch
- skip_default_browser_args: skip all hardcoded browser args, use only extra_args
- skip_default_headers: skip forced User-Agent/sec-ch-ua header overrides

All defaults unchanged — fully backward compatible.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant