xTerradon / hcaptcha-solver

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

Error handling when challenge closes during solving process #10

Closed ludwig7685 closed 11 months ago

ludwig7685 commented 11 months 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 11 months 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 11 months 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 11 months 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 11 months 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