admin管理员组文章数量:1296246
We use enterprise anchor google image reCaptcha in our website and while automating it with our test framework(playwright and python) with this plugin, for the first few runs it's working but then the next few times either the image captcha is not getting resolved and just proceeds with the next line of code or fails and gives the below exception. I am seeing around only 70% accuracy while using this. Since our website uses enterprise anchor image reCaptcha i m using v2 recaptcha. Below is the implementation of it:
try:
with recaptchav2.SyncSolver(page, capsolver_api_key=recaptcha_api_key) as solver:
page.wait_for_timeout(int(random.uniform(5.57, 8.59) * 1000))
token = solver.solve_recaptcha(wait=True, image_challenge=True)
print(f"\n\n\n\nRecaptcha Token: {token}.\n\n\n\n")
except Exception as e: # Catch other unexpected exceptions
print(f"\n\n\n\nAn unexpected error occurred: {e}\n\n\n\n")
raise
# next line of code to verify the recaptcha is resovled
Error logs
E playwright.\_impl.\_errors.Error: SyncSolver.solve_recaptcha: getaddrinfo ENOTFOUND www.google
E Call log:
E → GET ;k=6LdX518kAAAAAOW27hfHOIF8PqUA912D9DMKL5gV
E - user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/130.0.6723.31 Safari/537.36
E - accept: */*
E - accept-encoding: gzip,deflate,br
E - cookie: \_GRECAPTCHA=09AGVEItdxvV6zIQgIkFowqoG7ktUUCUIp6Z4XkQFmz7CcGPMtKCO36FKg6jE7TuD2tkSjV_FNjbSLJza9mcCUMUA
I have tried with different waits, looked over the github repo:
We use enterprise anchor google image reCaptcha in our website and while automating it with our test framework(playwright and python) with this plugin, for the first few runs it's working but then the next few times either the image captcha is not getting resolved and just proceeds with the next line of code or fails and gives the below exception. I am seeing around only 70% accuracy while using this. Since our website uses enterprise anchor image reCaptcha i m using v2 recaptcha. Below is the implementation of it:
try:
with recaptchav2.SyncSolver(page, capsolver_api_key=recaptcha_api_key) as solver:
page.wait_for_timeout(int(random.uniform(5.57, 8.59) * 1000))
token = solver.solve_recaptcha(wait=True, image_challenge=True)
print(f"\n\n\n\nRecaptcha Token: {token}.\n\n\n\n")
except Exception as e: # Catch other unexpected exceptions
print(f"\n\n\n\nAn unexpected error occurred: {e}\n\n\n\n")
raise
# next line of code to verify the recaptcha is resovled
Error logs
E playwright.\_impl.\_errors.Error: SyncSolver.solve_recaptcha: getaddrinfo ENOTFOUND www.google
E Call log:
E → GET https://www.google/recaptcha/enterprise/payload?p=06AFcWeA5eUk2jyo2U3O3454gQDI4kxakHE0ZRqGSLM-O0RJzBw1EYpm1n3oWKR6WTvY-q2QKf236oBZNlg2jxP_lsPrQyTqDQi9iyhbX80I01gbH7gO7bFfKnIQujUpgUBlTJ-80PkRmtlJ6y5GZDlTAP13EN62mv-SETzsGYKgVrSThVOb-CVh1a4NCeN43_2_Xrq-sZNb5AraoxYrs5OIdwFKbZo335eA&k=6LdX518kAAAAAOW27hfHOIF8PqUA912D9DMKL5gV
E - user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/130.0.6723.31 Safari/537.36
E - accept: */*
E - accept-encoding: gzip,deflate,br
E - cookie: \_GRECAPTCHA=09AGVEItdxvV6zIQgIkFowqoG7ktUUCUIp6Z4XkQFmz7CcGPMtKCO36FKg6jE7TuD2tkSjV_FNjbSLJza9mcCUMUA
I have tried with different waits, looked over the github repo: https://github/Xewdy444/Playwright-reCAPTCHA/issues%60
Share Improve this question asked Feb 11 at 20:59 Yuvaraj KYuvaraj K 191 silver badge3 bronze badges1 Answer
Reset to default 1I had a similar issue and found that CapSolver helped resolve it. Here's a simple code snippet using their API:
from caps_solver import SyncSolver
with SyncSolver(page, capsolver_api_key="your_api_key") as solver:
token = solver.solve_recaptcha(wait=True)
print(f"Recaptcha Token: {token}")
CapSolver supports a variety of captcha types and could improve the accuracy and reliability of your automation. Worth checking out!
本文标签: v2 reCaptcha from Playwrightrecaptch is inconsistentStack Overflow
版权声明:本文标题:v2 reCaptcha from Playwright-recaptch is inconsistent - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741635345a2389609.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论