
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
playwright-recaptcha
Advanced tools
A Python library for solving reCAPTCHA v2 and v3 with Playwright.
reCAPTCHA v2 is solved by using the following methods:
The solving of reCAPTCHA v3 is done by the browser itself, so this library simply waits for the browser to make a POST request to https://www.google.com/recaptcha/api2/reload or https://www.google.com/recaptcha/enterprise/reload and parses the response to get the g-recaptcha-response
token.
All solvers return the g-recaptcha-response
token, which is required for form submissions. If you are unsure about the version of reCAPTCHA being used, you can check out this blog post for more information.
pip install playwright-recaptcha
This library requires FFmpeg to be installed on your system for the transcription of reCAPTCHA v2 audio challenges.
OS | Command |
---|---|
Debian | apt-get install ffmpeg |
MacOS | brew install ffmpeg |
Windows | winget install ffmpeg |
You can also download the latest static build from here.
Note Make sure to have the ffmpeg and ffprobe binaries in your system's PATH so that pydub can find them.
If you would like to request support for a new language, please open an issue. You can also open a pull request if you would like to contribute.
For more reCAPTCHA v2 examples, see the examples folder.
from playwright.sync_api import sync_playwright
from playwright_recaptcha import recaptchav2
with sync_playwright() as playwright:
browser = playwright.firefox.launch()
page = browser.new_page()
page.goto("https://www.google.com/recaptcha/api2/demo")
with recaptchav2.SyncSolver(page) as solver:
token = solver.solve_recaptcha(wait=True)
print(token)
By default, the audio challenge will be solved. If you would like to solve the image challenge, you can set the CAPSOLVER_API_KEY
environment variable to your CapSolver API key. You can also pass the API key as an argument to recaptchav2.SyncSolver()
with capsolver_api_key="your_api_key"
. Then, set image_challenge=True
in solver.solve_recaptcha()
.
with recaptchav2.SyncSolver(page, capsolver_api_key="your_api_key") as solver:
token = solver.solve_recaptcha(wait=True, image_challenge=True)
print(token)
For more reCAPTCHA v3 examples, see the examples folder.
from playwright.sync_api import sync_playwright
from playwright_recaptcha import recaptchav3
with sync_playwright() as playwright:
browser = playwright.firefox.launch()
page = browser.new_page()
with recaptchav3.SyncSolver(page) as solver:
page.goto("https://antcpt.com/score_detector/")
token = solver.solve_recaptcha()
print(token)
It is best to initialize the solver before navigating to the page with the reCAPTCHA v3 challenge. This is because the solver adds a listener for the POST request to https://www.google.com/recaptcha/api2/reload or https://www.google.com/recaptcha/enterprise/reload and if the request is made before the listener is added, the g-recaptcha-response
token will not be captured.
This library is intended for use in automated testing and development environments only and should not be used for any illegal or malicious purposes. Any use of this library for activities that violate the terms of service of any website or service is strictly prohibited. The contributors of this library will not be held liable for any damages or legal issues that may arise from the use of this library. By using this library, you agree to these terms and take full responsibility for your actions.
FAQs
A library for solving reCAPTCHA v2 and v3 with Playwright
We found that playwright-recaptcha demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.