This is the final code for the tutorial you learn how to solve captcha using 2captcha. The general steps for solving captchas using 2captcha in Selenium are as follows:
- Create an account on 2captcha, add funds, and note the API Key.
- Note the Site key of the target Captcha.
- Submit the Site Key and Page URL to 2Captcha to solve the Captcha.
- Set the solved Captcha code on the appropriate element and submit the form.
Please refer to https://www.omkar.cloud/blog/how-to-solve-captcha-in-selenium-using-2captcha/ for a detailed tutorial on solving captchas using 2captcha.
- Replace "2CAPTCHA_API_KEY" with your 2captcha API Key.
- Replace "SITE_KEY" with the Site Key of the Captcha you want to solve.
- Install dependencies by running
python -m pip install 2captcha-python selenium webdriver-manager
. - Run
python main.py
.