This project is a Python automation script that simulates user interaction to bypass Cloudflare Turnstile challenges by locating and triggering the validation input inside nested Shadow DOM elements. It uses Selenium with undetected-chromedriver to reduce detection and access deeply embedded iframe and shadow-root structures.
- Automatically detects and interacts with Cloudflare Turnstile challenges.
- Navigates through Shadow DOM and nested iframes using Selenium.
- Clicks the challenge input using JavaScript execution.
- Built to work with the official 2Captcha Cloudflare demo page.
- Uses
undetected-chromedriverto avoid automation detection.
- Python 3.8+
- Google Chrome
- Chromedriver (automatically handled by
undetected-chromedriver)
Install the required libraries using:
pip install selenium undetected-chromedriver- Clone the repository:
git clone https://github.com/R4INYIS/cloudflare-captcha-solver/
cd cloudflare-captcha-solver- Edit the script (optional):
If you're testing on a different page or domain that uses Turnstile, make sure to update the URL value:
URL = "https://your-target-site.com/turnstile"Start the script by running:
python main.pyThe script will:
- Launch a Chrome window in automation mode.
- Load the target page with the Cloudflare Turnstile challenge.
- Access and interact with Shadow DOM layers and embedded iframe.
- Trigger the Turnstile validation click using JavaScript.
This project is for educational and testing purposes only. Automating security challenges like Turnstile may violate website terms of service. Always use responsibly and only where you are authorized to do so.