Quick Start
Enable Cloudflare solving with a single parameter:scrapling/engines/_browsers/_validators.py:131-133
Challenge Types
Scrapling detects and solves three types of Cloudflare challenges:Non-Interactive Challenge
The “Just a moment…” page that solves automatically:scrapling/engines/_browsers/_base.py:520-533
Implementation:
scrapling/engines/_browsers/_stealth.py:124-130
Managed Challenge
Interactive checkbox challenge:- Detects the challenge type from page content
- Locates the checkbox iframe
- Calculates precise click coordinates
- Clicks with human-like delay (100-200ms)
- Waits for network to settle
scrapling/engines/_browsers/_stealth.py:132-186
Interactive Challenge
More complex interactive challenges are handled the same way:Embedded Turnstile
Turnstile widgets embedded directly in pages:scrapling/engines/_browsers/_base.py:530-532
How It Works
Challenge Detection
Scrapling detects challenges by analyzing page content:scrapling/engines/_browsers/_base.py:502-534
Solving Process
- Wait for page stability - Ensure challenge is fully loaded
- Detect challenge type - Identify which Cloudflare challenge is present
- Locate challenge iframe - Find the Turnstile iframe using regex pattern
- Calculate click coordinates - Precise positioning with random offset
- Human-like interaction - Click with realistic delay
- Wait for resolution - Monitor page for challenge completion
- Retry if needed - Recursive solving for stubborn challenges
scrapling/engines/_browsers/_stealth.py:111-186
Click Coordinate Calculation
scrapling/engines/_browsers/_stealth.py:159-163
Usage Patterns
One-off Requests
Session-based Scraping
Spider Integration
Async Usage
Advanced Configuration
Custom Timeout
Some challenges take longer to solve:With Proxy Rotation
Page Actions After Solving
Perform actions after the challenge is solved:page_action runs after Cloudflare solving completes.
Source: scrapling/engines/_browsers/_stealth.py:243-252
Wait for Specific Content
Combine with selectors to wait for content after solving:Troubleshooting
Challenge Not Detected
Challenge Not Detected
Scrapling logs challenge detection:If no challenge is found, the page may not be protected or uses a different system.
Timeout Errors
Timeout Errors
Increase timeout for slow challenges:
Challenge Still Present
Challenge Still Present
The solver retries recursively:Source:
scrapling/engines/_browsers/_stealth.py:184-186Multiple Challenges
Multiple Challenges
Some sites show multiple challenges. Use sessions to maintain cookies:
Limitations
- CAPTCHA challenges - Image-based CAPTCHAs require manual solving or third-party services
- Rate limiting - Solving challenges too frequently may trigger additional protections
- WAF rules - Some sites use custom WAF rules beyond Cloudflare’s standard challenges
Best Practices
- Use sessions - Reuse cookies across requests to avoid re-solving
- Set adequate timeout - Minimum 60 seconds, 90-120 seconds recommended
- Monitor logs - Check for challenge detection and solving status
- Combine with other features - Use with
hide_canvas,block_webrtc, etc. - Respect rate limits - Add delays between requests
Related Documentation
Anti-Bot Bypass
General anti-bot bypass strategies
Handling Blocked Requests
Detect and retry blocked requests
Error Handling
Handle errors and timeouts
Performance Tips
Optimize scraping performance