DataDome solver for Playwright Python
DataDome scores every request — pure headless Playwright trips the shield within seconds. Use a Sonic-issued datadome cookie to traverse protected pages without raising the score.
Runnable example
from playwright.async_api import async_playwright
from captchasonic import CaptchaSonic
sonic = CaptchaSonic('YOUR_API_KEY')
result = sonic.solve(
type='DataDomeTask',
website_url='https://target.example.com/protected',
user_agent='Mozilla/5.0 (...)',
)
async with async_playwright() as p:
browser = await p.chromium.launch()
ctx = await browser.new_context(user_agent='Mozilla/5.0 (...)')
await ctx.add_cookies([{ 'name': 'datadome', 'value': result.cookie, 'domain': 'target.example.com', 'path': '/' }])
page = await ctx.new_page()
await page.goto('https://target.example.com/protected/list')Replace YOUR_API_KEY with a real key from your dashboard. The token is good for one form submission.
FAQ
- Why pass the cookie before navigation?
- DataDome scores the very first request. Pre-loading the cookie into the Playwright context means the gateway sees a valid session on byte zero instead of issuing a challenge then receiving the cookie on retry.
- How long does the datadome cookie stay valid?
- Typically about 1 hour per origin and fingerprint. Cache across requests within that window — re-solving on every navigation is wasted spend.
- Does the cookie work in headless mode?
- Yes, but pair it with a residential proxy — DataDome correlates the cookie's fingerprint with the egress IP, so a datacenter IP can still trip the shield even with a valid cookie.
Other DataDome stacks
- Cloudflare Turnstile · Playwright · PythonPass Cloudflare Turnstile from Playwright Python. Sonic returns the cf-turnstile-response token in under 7 seconds, ready to drop into the page.
- reCAPTCHA Enterprise · Playwright · PythonPass reCAPTCHA Enterprise from Playwright Python. Sonic returns an action-bound Enterprise token with high confidence scores.
- hCaptcha · Playwright · PythonSolve hCaptcha from Playwright Python with a Sonic-issued token. Drop-in for both standard and Enterprise widgets.
How CaptchaSonic compares for this captcha
Feature-by-feature against the four most-mentioned alternatives. Independently benchmarked; numbers refresh quarterly.
| Feature | CaptchaSonic | 2Captcha | CapSolver | Anti-Captcha | CapMonster Cloud |
|---|---|---|---|---|---|
| AI / ML solver (no human relay) | |||||
| AWS WAF / DataDome | |||||
| Success rate (trailing 30d) | 99.9% | ~95% | ~98% | ~95% | ~97% |
| Proxy + proxyless modes | |||||
| Free trial credits | |||||
| SDK languages (Py, Node, Go, C#, Java, PHP) | 6 | 6 | 4 | 5 | 4 |
| Selenium / Puppeteer / Playwright examples | |||||
| Browser extension | |||||
| Webhook callbacks | |||||
| 99.9% uptime SLA |
Yes / No / Partial reflect publicly documented support. Pricing and solve-time figures snapshot the published rate at the time this page was last updated.
Related guides
- reCAPTCHA Solver
AI bypass for reCAPTCHA v2, v3 and Enterprise.
- hCaptcha Solver
Token solver for hCaptcha and hCaptcha Enterprise.
- API Docs
createTask, getTaskResult, getBalance — full reference.
- GeeTest v3 / v4
Slide, icon, space and gobang puzzles solved.
- MTCaptcha Solver
Token bypass for invisible and visible MTCaptcha.
- AWS WAF Captcha
AWS WAF token solver for the WAF-CAPTCHA challenge.