feat: support system-installed browsers via channel and executable path - #243
Open
SantosVilanculos wants to merge 2 commits into
Open
feat: support system-installed browsers via channel and executable path#243SantosVilanculos wants to merge 2 commits into
SantosVilanculos wants to merge 2 commits into
Conversation
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
marked this pull request as ready for review
August 3, 2026 12:31
- Restrict usingChannel() to Chromium-family channels (chrome, msedge and their beta/dev/canary variants) and document that Playwright only supports Chromium-family binaries via executablePath, so branded Firefox/Safari builds (e.g. /usr/bin/firefox) are not valid examples. - Make usingChannel() and usingExecutablePath() mutually exclusive by throwing an InvalidArgumentException when combined. - URL-encode the launch-options payload in the Playwright connection query instead of interpolating raw JSON, so paths with spaces or special characters round-trip correctly. - Extract launchOptions() and connectionQuery() on Client and cover the new behavior with tests.
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.
Summary
Adds two new
pest()->browser()configuration options to launch system-installed browsers instead of the Playwright-bundled browsers:The supported channels match Playwright's
#configure-browsersdocs:chrome,chrome-beta,chrome-dev,chrome-canary,msedge,msedge-beta,msedge-dev,msedge-canary.Motivation
No downloaded Playwright browser bundles are needed — great for environments that already have Chrome/Edge installed and want to avoid
npx playwright install.Unlocks browsers on distros Playwright's installer refuses to support
Playwright's channel install scripts (
bin/reinstall_chrome_stable_linux.sh,bin/reinstall_msedge_*_linux.sh) are hard-gated to Ubuntu/Debian: they source/etc/os-releaseand abort otherwise. On Linux Mint:So a machine that already has Chrome installed still can't use the
chromechannel whennpx playwright install chromeis part of the bootstrap. This PR removes that whole step: the browser is launched in place, so there is no download, no distro gate, and the system installation is never touched. (On Ubuntu/Debian the Playwright installer would evenapt-get remove google-chromeand reinstall the.deb— a disruptive no-op for anyone who already has Chrome.)Verified end-to-end on Linux Mint (an unsupported distro) with the system Chrome 151:
visit(...)->screenshot(...)emits real screenshots while~/.cache/ms-playwrightstays empty. Same benefit on Fedora, Arch, openSUSE, etc., and in CI images that preinstall browsers.Implementation
Configuration::usingChannel(string)andConfiguration::usingExecutablePath(string)config methods, plus static channel/executablePath state onPlaywrighthttp_build_query) so executable paths containing spaces or special characters round-trip correctlyrun-serveris started with--unsafewhen anexecutablePathis set, because the server otherwise filters that launch option out (seefilterLaunchOptionsin playwright-core);channelis always accepted without--unsafeusingChannel()andusingExecutablePath()are mutually exclusive and throw anInvalidArgumentExceptionif combinedScope
Playwright only supports Chromium-family binaries via channel/executablePath. Branded Firefox and Safari builds are not supported because Playwright relies on its own patched builds of those browsers — so
usingExecutablePath('/usr/bin/firefox')does not work. Use the bundled Firefox (inFirefox()) for Firefox tests.Tests
tests/Unit/Configuration/SystemBrowserConfigurationTest.php— channel/path configuration, fluent chaining, mutual-exclusiontests/Unit/Playwright/ClientTest.php— launch-option forwarding and connection-query encodingNotes
channelis the recommended approach for Chromium-based system browsers and requires no server flags.executablePathrequires the--unsafeserver mode (added conditionally).