Captcha handling using Selenium

雨燕双飞 提交于 2019-12-12 16:00:49

问题


I am trying to automate one form where I get re-Captcha as a part of form submission. I got stuck and figuring out that how can we handle the captcha text using selenium webdriver. Though this captcha is turing test implementation in realtime but, still I am finding some way so that I can handle this scenario.


回答1:


So you can't really do that, captcha is by definition meant to break your automation. That said, I have had some luck using Tesseract OCR, but I was dealing with rather simplistic ones that contained only numbers. While I was doing that, I also looked into some javascript based solutions, but I was unable to achieve any success with those. I think it is worth giving a try, but most probably you are out of luck




回答2:


If you are using the new Google unobtrusive reCaptcha v3, the back end call to https://www.google.com/recaptcha/api/siteverify returns a score value between 0 (100% Bot) and 1.0 (100% human). You can choose the threshold level of 'humanity' and, can move this threshold into environment-specific configurations.

e.g. What we do is set a threshold value of around 0.7 in our production system, but in our development environments where we run our Selenium tests, we set this threshold to 0 in order to allow our Se tests to verify the functional correctness of our external facing forms.

We have also run a Selenium smoke test against our production environment (where the threshold is 0.7) to ensure that the Captcha is correctly configured and does prevent abuse.



来源:https://stackoverflow.com/questions/29466687/captcha-handling-using-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!