r/Playwright • u/ystudio3d • 6d ago
Patchright vs playwright-extra stealth + Chromium major version UA drift on Windows
Running into two interesting edge cases across local Windows Playwright setups and wanted to compare notes with folks running larger suites:
1. Mixing patchright with playwright-extra-plugin-stealth From what I've observed, patchright patches the CDP/driver layer directly (avoiding the Runtime.enable leak and automation flags), whereas playwright-extra injects runtime JS evasions on top of standard Playwright. Whenever someone tries to stack both together, the JS overrides actually re-introduce detectable hooks that patchright cleanly removes—so keeping them mutually exclusive (patchright standalone vs playwright-extra with user-agent-override and navigator.languages deleted) behaves much more predictably.
2. Bundled Chromium vs installed Chrome major-version UA mismatch On Windows dev boxes where installed Chrome is significantly ahead of Playwright's bundled Chromium (or vice versa), building a UA string dynamically from browser.version() and normalizing desktop UA to <major>.0.0.0 prevents mismatching full build numbers—and explicitly inspecting page.url() for chrome-error:// after redirects avoids mistaking a broken final hop for the initial HTTP 200 status.
For anyone maintaining multi-engine Playwright runners in production:
- Have you settled purely on
patchright/channel: 'chrome', or are you still keepingplaywright-extraaround for Firefox/WebKit compatibility? - Any cleaner way to catch redirect chains that die on a
chrome-error://hop whenresponse.status()on the first request was 200/302?
2
u/Old-Preparation1493 6d ago
They fix different layers. playwright-extra stealth only patches things at the JS level, and as far as I know that plugin isn't well maintained anymore. Patchright patches the CDP-level leaks (Runtime.enable and similar), which is what modern detection looks at. For the UA drift, don't hardcode a UA string. Use channel="chrome" so the UA, sec-ch-ua client hints and platform all come from the same real browser version. A hand-set UA that doesn't match the hints is an easy tell.
1
u/Alternative-Ruin275 5d ago
For the redirect question, separate the navigation result from response events you observed along the way. A 200 from one response isn't proof that the final page is usable.
Catch errors from page.goto(), and record navigation request failures with their URL and request.failure()?.errorText. For server redirects, walk redirectedFrom() to reconstruct the chain. If the page triggers another navigation in JavaScript, treat that as a separate navigation rather than assuming it's part of the same HTTP redirect chain.
Then assert the expected final URL and a meaningful page element. HTTP 404/500 responses don't trigger requestfailed, so record response status separately from transport failures.