I'm currently writing Playwright tests for a site that uses Turnstile CAPTCHA validation. On our testing systems, the CAPTCHA uses the 'always-pass' site and private keys.
The issue I'm facing is that—unless I run the tests in headed mode—the CAPTCHA element doesn’t render at all. During server‐side validation, the "failed" state is shown, which I interpret to mean that Playwright isn’t even attempting to fetch or render the CAPTCHA.
When I run the tests in headed mode, everything works as expected. This does not apply to UI-mode
Question:
How can I ensure that Playwright renders the CAPTCHA element as a user would, without running in headed mode?
I've considered always running the tests in headed mode, but this is not a viable solution in our use case.
Playwright version: 1.53.1
Browsers: All browsers
CAPTCHA: Cloudflare turnstil
(If this has been answered before, apologies—I searched but only found discussions from people trying to bypass CAPTCHAs, which isn’t what I’m doing.)
-
Why not share your code so far as a minimal reproducible example, so we don't need to build that up from scratch, and can address your exact issue?ggorlen– ggorlen2025年10月22日 00:31:44 +00:00Commented Oct 22, 2025 at 0:31
-
For multiple reasons: 1. I don't have an example - my tests run on a private testing server 2. I hoped someone already ran into the same issue, and knows the solution - figuring out a solution would probably not be done in 5 min.user27925777– user279257772025年10月22日 07:18:15 +00:00Commented Oct 22, 2025 at 7:18