How to Bypass reCAPTCHA v2 Using Tampermonkey and 2Captcha API
https://2captcha.com/h/how-to-bypass-captcha-using-tampermonkey
As a technical specialist, I often deal with websites that use reCAPTCHA v2 to block bots and automation. While this is understandable from a security perspective, there are legitimate cases — such as automated testing, data scraping, or form submissions — where bypassing captchas in a controlled environment becomes necessary.
In this article, I’ll walk you through how to automate solving reCAPTCHA v2 using the Tampermonkey browser extension and the 2Captcha API, with a fully functional userscript written in JavaScript.
Prerequisites
Before we start, ensure you have the following:
-
✅ Tampermonkey installed in your browser (Download here)
-
✅ An active 2Captcha.com account and API key
-
✅ Basic knowledge of JavaScript and how to inspect elements in the browser
Installing and Setting Up Tampermonkey
-
Go to tampermonkey.net and install the extension for your preferred browser.
-
Click the Tampermonkey icon and open the Dashboard.
-
Click “Create a new script”.
-
Paste the userscript provided below.
-
Replace
YOUR_2CAPTCHA_API_KEY
with your actual API key from 2Captcha. -
Save and reload any target page containing reCAPTCHA v2.
Understanding the Script
This script performs the following steps:
-
Detects the presence of reCAPTCHA v2
-
Extracts the
sitekey
value from the DOM -
Submits a task to 2Captcha to solve the challenge
-
Waits for the solution using polling
-
Injects the response token into the page
-
Optionally submits the form automatically
reCAPTCHA v2 Solver Script
Technical Considerations
-
Captcha Load Timing: Ensure the script runs only after the captcha is rendered. If needed, use
MutationObserver
or explicit delays. -
2Captcha Account: Your account must have a positive balance. A zero balance will result in task errors.
-
Error Handling: Use your browser console to monitor logs or troubleshoot any failures.
-
User Events: Some forms may require simulating human actions (e.g., clicking) to allow form submission post-injection.
Summary
This Tampermonkey-based solution allows seamless client-side automation of reCAPTCHA v2 challenges using 2Captcha’s proxyless API. It’s ideal for developers automating workflows or running repetitive tests without backend integration.
What’s Next?
We’re actively working on support scripts for:
-
reCAPTCHA v3
-
Invisible captchas
-
Cloudflare Turnstile
-
Proxy-based solving (if needed for stricter environments)
If you need help adapting this to your specific use case or want to request additional captcha support — feel free to reach out.
Комментарии
Отправить комментарий