Skip to content

feat: support system-installed browsers via channel and executable path - #243

Open
SantosVilanculos wants to merge 1 commit into
pestphp:5.xfrom
SantosVilanculos:feat/system-browsers
Open

feat: support system-installed browsers via channel and executable path#243
SantosVilanculos wants to merge 1 commit into
pestphp:5.xfrom
SantosVilanculos:feat/system-browsers

Conversation

@SantosVilanculos

Copy link
Copy Markdown

Summary

Adds two new pest()->browser() configuration options to launch system-installed browsers instead of the Playwright-bundled browsers:

// Google Chrome / Microsoft Edge (Playwright's "channel" mechanism)
pest()->browser()->usingChannel('chrome');

// any browser binary, e.g. Firefox
pest()->browser()->usingExecutablePath('/usr/bin/firefox');

Motivation

No downloaded Playwright browser bundles are needed — great for environments that already have Chrome/Firefox/Edge installed and want to avoid npx playwright install.

Implementation

  • Configuration::usingChannel(string) and Configuration::usingExecutablePath(string) config methods
  • Static channel/executablePath state on Playwright
  • Both forwarded as launch options in the Playwright client
  • Playwright's run-server is started with --unsafe when an executablePath is set, because the server otherwise filters that launch option out (see filterLaunchOptions in playwright-core); channel is always accepted

Tests

  • New tests/Unit/Configuration/SystemBrowserConfigurationTest.php
  • All tests/Unit/Configuration + tests/Unit/Playwright pass, Pint + arch pass

Notes

  • channel is the recommended approach for Chromium-based system browsers and requires no server flags.
  • executablePath requires the --unsafe server mode (added conditionally).

Add two new configuration options to launch system-installed browsers
instead of the bundled Playwright browsers:

- pest()->browser()->usingChannel('chrome') for branded browsers such as
  Google Chrome or Microsoft Edge, which Playwright's server accepts out
  of the box.
- pest()->browser()->usingExecutablePath('/usr/bin/firefox') for any
  browser binary; the Playwright server is started with --unsafe so the
  executablePath launch option is not filtered out.

Both options are forwarded as launch options in the Playwright client.
@SantosVilanculos
SantosVilanculos marked this pull request as ready for review August 3, 2026 12:31
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