When you enable CAPTCHA solving in your project, CAPTCHAs are solved automatically in the background. However, your automation may need to wait for a CAPTCHA to be solved before proceeding, or know when a CAPTCHA was solved. These helpers let you wait for CAPTCHAs to be solved and react to status changes.Documentation Index
Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
CAPTCHA is a general term for challenges that verify you’re human. This includes reCAPTCHA, hCaptcha, Cloudflare Turnstile, and similar services.
Available helpers
wait_for_captcha_solve— Wait for a CAPTCHA to be solvedon_captcha_event— Register a callback for CAPTCHA updatesonce_captcha_event— Register a one-time callback for a CAPTCHA updateremove_captcha_event_listener— Remove a previously registered callback
Function reference
wait_for_captcha_solve
Wait for a CAPTCHA to be solved. Supports three usage patterns: callable, wrapper, and decorator. Note: The decorator pattern is available in Python only. TypeScript uses direct call and wrapper patterns. In Python, the decorator can be used either as@wait_for_captcha_solve or @wait_for_captcha_solve(...).
- Callable
- Wrapper
- Decorator
wait_for_captcha_solve(page, ...) and
wait_for_captcha_solve(page=page, ...). The wrapper form below is keyword-only
because it requires both page= and func=.ParametersPlaywright page object.
Maximum wait time in seconds. Raises
TimeoutError if exceeded.Wait time in seconds before checking if CAPTCHAs appeared. Resets when a CAPTCHA is detected during the period.
None when solved or settle period elapses.Raises
TimeoutError— Raised whentimeout_selapses while CAPTCHAs are still being solved.CaptchaSolveError— Raised when the CAPTCHA solver fails. Contains aCaptchaErrorwith the error code and details.RuntimeError— Raised when the subscription cannot be created or the page context is invalid.
Examples
on_captcha_event
Parameters
Playwright page object.
The CAPTCHA status to listen for.
Callback function that executes when the status is observed. Receives a
Captcha instance as its only argument.Returns Returns
None. The function subscribes and returns immediately. The callback fires each time a CAPTCHA with the specified status is observed.
Raises
RuntimeError— Raised when the subscription cannot be created or the page context is invalid.
once_captcha_event
Parameters
Playwright page object.
The CAPTCHA status to listen for.
Callback function that executes when the status is observed. Receives a
Captcha instance as its only argument.Returns Returns
None. The function subscribes and returns immediately. The callback fires at most once.
Raises
RuntimeError— Raised when the subscription cannot be created or the page context is invalid.
remove_captcha_event_listener
on_captcha_event or once_captcha_event. You must pass the same page, status, and callback function that were used to register the callback.
Parameters
Playwright page object.
The CAPTCHA status that the listener was registered for.
The callback function that was originally registered. Must be the same function reference.
Returns Returns
None. The function unsubscribes the callback and returns immediately.
Raises
RuntimeError— Raised when the callback cannot be removed or the page context is invalid.
once_captcha_event are automatically removed after firing.
Best practices
- Use the wrapper or decorator forms when a navigation, submit, or click may trigger the challenge.
- Use the callable form only after the page has already settled and the CAPTCHA is already present.
- Set timeout values high enough for real challenges.
60.0to120.0seconds is a safer default than10.0seconds for production flows. - Adjust the settle period for the wait before checking status. It resets when CAPTCHAs are detected.
- Leave
wait_for_network_settledenabled for wrapper and decorator usage unless you have a reason to skip it. - Subscribe to CAPTCHA updates using
on_captcha_eventoronce_captcha_eventfor telemetry and monitoring. - Store callback function references if you need to unsubscribe later.
Type reference
Captcha
Unique identifier for the CAPTCHA observation.
Browser tab ID where the CAPTCHA was detected.
CAPTCHA provider type, such as
recaptcha, hcaptcha, or cloudflare.Current solving state.
Number of solve attempts made. Defaults to
0.Error details when
status is error, otherwise None.CaptchaStatus
attached— CAPTCHA element detected in the page. Use this to know when a challenge appears.solving— Solver is actively processing the CAPTCHA.solved— CAPTCHA solved successfully. Resume your workflow.error— Solver failed. Check theerrorfield for details.detached— CAPTCHA element removed from the page. Treat as cancelled.
CaptchaError
Error code indicating the type of failure.
Additional error details, if available.
CaptchaErrorCode
HIT_LIMIT— Reached billing limits for CAPTCHA solves. See Plans and billing for details on limits and upgrading.MAX_RETRIES— Exceeded maximum retry attempts specified insettings.maxRetries.UNEXPECTED_ERROR— An unexpected error occurred while solving. This is a solver error and not related to your automation.UNEXPECTED_SERVER_RESPONSE— The solver received an unexpected response. This is a solver error and not related to your automation.