0

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.)

asked Oct 21, 2025 at 9:14
2
  • 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? Commented 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. Commented Oct 22, 2025 at 7:18

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.