xTerradon / hcaptcha-solver

Automated hCaptcha solver using binary image classification networks
https://pypi.org/project/hcaptcha-solver/
23 stars 8 forks source link

Error handling when challenge closes during solving process #10

Closed ludwig7685 closed 1 year ago

ludwig7685 commented 1 year ago

if i copy testing/test.py ( the code copying ) and past it in app.py, run app.py, i get hcaptcha solved!

if i copy the example code in READ.md, i get a error!

app.py: Screenshot (4)

main.py: Screenshot (5)

console: Screenshot (6)

its REALLY WEIRD!!!!!!!!!! I removed the "h" in line 10 last word from "hcaptcha" !!!!!!!! And it works!!!!

xTerradon commented 1 year ago

Hey, thanks for testing the code! Comments do not have an impact on code execution, so the issue lies somewhere different than the "h". In your case, 'solve_challenge' expects an open challenge view, but recognizes that no open challenge is active. It then throws the Exception explaining the error. Most likely something was clicked before the code could execute or the captcha timed out. This sometimes happens as the website reloads, things take longer to load than expected etc. It's hard to catch all the possible errors with selenium, but I will try my best to fix it so the program retries solving the captcha instead of aborting

Shaeikh commented 1 year ago

For me the Verbose=True argument was giving out an error prob becaz of the pkg version but it was fixed after I updated the pkg

code:

from hcaptcha_solver import hcaptcha_solver # hcaptcha_solver-0.2.13
from selenium import webdriver

options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=options)
captcha_solver = hcaptcha_solver.Captcha_Solver(verbose=True)

options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})

driver.get("https://accounts.hcaptcha.com/demo")

captcha_solver.is_captcha_present(driver)
captcha_solver.solve_captcha(driver)
xTerradon commented 1 year ago

@Shaeikh the verbose argument was introduced in v0.2.13
I am updating the repo quite actively at the moment so make sure to stay up to date. Thanks for your help!

xTerradon commented 1 year ago

This issue is adressed in v0.2.14, as the solver restarts the solving process when it encounters an error during the challenge solving steps