Troubleshooting / selenium-detected-by-recaptcha
Selenium detected by reCAPTCHA — fix the detection
Your Selenium script loads the page fine, but the reCAPTCHA widget either shows the "I am not a robot" checkbox in an unsolvable state or fails on submission.
Cause
Selenium exposes navigator.webdriver=true plus a small number of CDP-specific fingerprint markers (puppeteer-specific console permissions, predictable user-agent, missing window.chrome runtime methods). reCAPTCHA scores these signals and downscores or hard-blocks the session.
Fix
Stop driving the widget. Use a Sonic-issued reCAPTCHA token instead — Sonic solves server-side from a clean fingerprint, returns the gRecaptchaResponse string, and you write it into the page's hidden textarea before submitting. The browser never interacts with the widget, so the detection chain breaks entirely.
from captchasonic import CaptchaSonic
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://example.com/login')
sonic = CaptchaSonic('YOUR_API_KEY')
token = sonic.solve(
type='RecaptchaV2TaskProxyless',
website_url=driver.current_url,
website_key='6Le-...',
).gRecaptchaResponse
driver.execute_script(
'document.getElementById("g-recaptcha-response").value = arguments[0];',
token,
)
driver.find_element('css selector', 'form').submit()Частые вопросы
Sometimes. reCAPTCHA also uses behavior signals (mouse entropy, timing) on top of the JS fingerprint — those are harder to fake than navigator.webdriver. Token injection bypasses that check entirely.
Yes for the rest of your scrape — login, form fields, navigation. Just skip the widget interaction. Token injection happens via execute_script and the form submit happens normally.