feat: switch stealth Chromium default channel to consumer Chrome
CI / test (push) Successful in 2m16s
CI / build (push) Successful in 2m25s
CI / vet (push) Successful in 2m16s

Playwright's bundled Chromium has a distinct build fingerprint (build ID,
uniform WebGL/codec lists, HeadlessChrome residue) that anti-bot services
increasingly flag. Driving a system-installed Google Chrome via Playwright's
channel option sheds that signal and aligns sec-ch-ua with UA more cleanly.

Changes:
- Add BrowserOptions.Channel string field (chrome, chrome-beta, chromium,
  msedge; empty = default).
- When stealth+headless+Chromium and Channel is empty, default to "chrome"
  (was "chromium"). Explicit Channel values always win, so callers can opt
  back to "chromium" or pick another channel.
- Merge Channel in mergeOptions.
- Expose --channel/--ch flag on cmd/browser for A/B fingerprint testing.

Callers must have the chosen browser installed on the host
(e.g. `playwright install chrome`). Firefox and WebKit paths are untouched.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 17:26:50 +00:00
parent 9987b94233
commit c3be14095a
3 changed files with 32 additions and 2 deletions
+9
View File
@@ -90,6 +90,15 @@ type BrowserOptions struct {
// evasions are applied automatically (launch args + init scripts). When nil,
// defaults to true in NewBrowser / NewInteractiveBrowser.
Stealth *bool
// Channel selects a Chromium-family browser channel when Browser is
// BrowserChromium. Accepted values include "chrome", "chrome-beta",
// "chromium", "msedge". Empty defaults to "chrome" when stealth+headless
// (real Chrome sheds the bundled-Chromium fingerprint); otherwise falls
// back to Playwright's bundled browser. The chosen channel must be
// installed on the host (e.g. `playwright install chrome`). Ignored when
// Browser is not BrowserChromium.
Channel string
}
func sameSiteToPlaywright(s SameSite) *playwright.SameSiteAttribute {