Skip to main content
https://img.shields.io/pypi/v/ta_captcha_solver.svg https://img.shields.io/travis/macejiko/ta_captcha_solver.svg Documentation Status

Thoughtful Captcha Solver


Installation

python3 -m virtualenv venv
source venv/bin/activate
pip install ta-captcha-solver

How to Use

  1. Make sure your browser instance is on the page with captcha or provide a correct path to image in image_source param

  2. Use TACaptchaSolver.get() method with appropriate params

  3. Call captcha.solve() method that would do all the magic


Supported Browsers

Currently only RPA.Browser.Selenium.Selenium() is supported. In future we will add a Playwright support as well


Supported Service Providers

Currently we support these:

  1. http://learn.captcha.guru/#/

  2. https://2captcha.com/2captcha-api

You should have valid API key that could be obtained from web version of service after you put some money to the account balance


Supported Captcha Types

Currently we support these:

  1. CloudFlare

  2. CloudFlare Challenge

  3. Arkose Labs Fun Captcha

  4. HCaptcha

  5. ReCaptcha v2

  6. Image Captcha


Available Settings

If param is not required and not set then this action would not be performed and you a responsible for it. E.g. if you dont provide check_xpath then you should check that captcha has been solved by you own.

Param

Required

Type

Description

captcha_type

Yes

All

One of supported captcha types

browser

Yes for ‘v2’ and ‘fun_captcha’ For ‘image’ only when image_source is not provided.

All

Supported browser instance with opened captcha page

captcha_guru_api_key

No

All

Deprecated. Use ‘service_provider_name’ + ‘service_provider_key’ instead

service_provider_name

Yes

All

Value should be: ‘captcha.guru’ or ‘2captcha’

serivce_provider_key

Yes

All

Valid API key of appropriate Service Provider

image_xpath

Yes if browser is provided

Image

Locator of <img> with captcha pic

input_xpath

No

Image

Locator of input field for token

click_xpath

No

All

Locator of submit button

check_xpath

No

All

Locator that should be verified after solving

upper

No

Image

Perform token.upper()

image_source

Yes if browser not provided

Image

Path to .png or .jpg image with captcha to solve


Examples

 from RPA.Browser.Selenium import Selenium
 from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver

 browser = Selenium()
 browser.open_browser("http://url_with_captcha")

 captcha = TACaptchaSolver.get(
     captcha_type="v2",
     browser=browser,
     service_provider_name="captcha.guru",
     service_provider_key="captcha.guru API KEY",
 )
captcha.solve()
 from RPA.Browser.Selenium import Selenium
 from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver

 browser = Selenium()
 browser.open_browser("http://url_with_captcha")

 captcha = TACaptchaSolver.get(
     captcha_type="image",
     browser=browser,
     service_provider_name="captcha.guru",
     service_provider_key="captcha.guru API KEY",
     image_xpath="//img[@id='demoCaptcha_CaptchaImage']",
     input_xpath="//input[@id='captchaCode']",
     click_xpath="//input[@id='validateCaptchaButton']",
     check_xpath="//span[@id='validationResult']/span[@class='correct']",
     upper=False,
 )
captcha.solve()
from RPA.Browser.Selenium import Selenium
from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver

browser = Selenium()
browser.open_browser("http://url_with_captcha")

captcha = TACaptchaSolver.get(
    captcha_type="fun_captcha",
    browser=self.browser,
    service_provider_name="2captcha",
    service_provider_key="2captcha API KEY"
    check_xpath="//input[@id='username']",
)
captcha.solve()
 from ta_captcha_solver.ta_captcha_solver import TACaptchaSolver

 captcha = TACaptchaSolver.get(
     captcha_type="image",
     service_provider_name="2captcha",
     service_provider_key="2captcha API KEY",
     image_source= "C:/your-path-to-image-captcha.png",
     upper=False,
 )
captcha.solve()
token = captcha.token

Development

Prepare local dev env:

python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

Testing:

CAPTCHA_GURU_API_KEY=XXX TWO_CAPTCHA_API_KEY=YYY pytest

Release files for ta-captcha-solver 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ta-captcha-solver 0.3.7
File Size Uploaded
ta_captcha_solver-0.3.7.tar.gz 14.1 kB Details

Release files / ta_captcha_solver-0.3.7.tar.gz

Download URL ta_captcha_solver-0.3.7.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6170ccabec94e496f20659356b9751db963e9b04ab0892209b6dc61a9779807c
BLAKE2b-256 checksum
How to use checksums
a74034ecc5371293e567659e2f952d85418a300efe608e2f7680a003e89d3091
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.3.7 This release

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page