Package: ta-captcha-solver
Thoughtful Captcha SolverInstallationpython3 -m virtualenv venv
source venv/bin/activate
pip install ta-captcha-solverHow to UseMake sure your browser instance is on the page with captcha or provide a correct path to image inimage_sourceparamUseTACaptchaSolver.get()method with appropriateparamsCallcaptcha.solve()method that would do all the magicSupported BrowsersCurrently onlyRPA.Browser.Selenium.Selenium()is supported. In future we will add aPlaywrightsupport as wellSupported Service ProvidersCurrently we support these:http://learn.captcha.guru/#/https://2captcha.com/2captcha-apiYou should have valid API key that could be obtained from web version of service after you put some money to the account balanceAvailable SettingsIf 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 providecheck_xpaththen you should check that captcha has been solved by you own.ParamRequiredTypeDescriptioncaptcha_typeYesAllOne of supported captcha typesbrowserYes for ‘v2’ and
‘fun_captcha’
For ‘image’ only
when image_source
is not provided.AllSupported browser instance with opened captcha pagecaptcha_guru_api_keyNoAllDeprecated. Use ‘service_provider_name’ + ‘service_provider_key’ insteadservice_provider_nameYesAllValue should be: ‘captcha.guru’ or ‘2captcha’serivce_provider_keyYesAllValid API key of appropriate Service Providerimage_xpathYes if
browser
is providedImageLocator of <img> with captcha picinput_xpathNoImageLocator of input field for tokenclick_xpathNoAllLocator of submit buttoncheck_xpathNoAllLocator that should be verified after solvingupperNoImagePerform token.upper()image_sourceYes if browser
not providedImagePath to .png or .jpg image with captcha to solveExamplesfromRPA.Browser.SeleniumimportSeleniumfromta_captcha_solver.ta_captcha_solverimportTACaptchaSolverbrowser=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()fromRPA.Browser.SeleniumimportSeleniumfromta_captcha_solver.ta_captcha_solverimportTACaptchaSolverbrowser=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()fromRPA.Browser.SeleniumimportSeleniumfromta_captcha_solver.ta_captcha_solverimportTACaptchaSolverbrowser=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()fromta_captcha_solver.ta_captcha_solverimportTACaptchaSolvercaptcha=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.tokenDevelopmentPrepare local dev env:python3 -m virtualenv venv
source venv/bin/activate
pip install -r requirements.txtTesting:CAPTCHA_GURU_API_KEY=XXX TWO_CAPTCHA_API_KEY=YYY pytest