How to acceptance test captcha-protected web application functionality?

拈花ヽ惹草 提交于 2019-12-10 14:19:18

问题


I would like to add a captcha, such as reCaptcha, to a certain functionality on my site. How could I adapt my acceptance tests?

Is the only solution to disable the captcha's on the staging site?

Clarification:

Of course I am not speaking of brute-force cracking my own captcha, but e.g. some option to inject a state into the captcha from the server side that my test knows about.

PS My server side code uses the Pyramid framework, and my tests are written using Selenium


回答1:


The point isn't to test Captcha with your Selenium tests -- Why spend the significant effort to test a third party tool?

Instead, I'd have a Selenium test that verifies your Captcha is showing up. This validates your Captcha is present and active. After that test I'd turn Captcha off and proceed with your other validation tests. I'd also have a final step of turning Captcha back on and repeating the test detecting Captcha is active. That way you're ensuring you didn't miss something when reactivating Captcha.




回答2:


Yes, the only option is disabling Captcha - for a very good reason. If it's easy enough to bypass it with Selenium, why would you have a Captcha in the first place?




回答3:


Disable the CAPTCHA by using a test code in the input box. If the captcha fails but matches the test code, continue.



来源:https://stackoverflow.com/questions/12373434/how-to-acceptance-test-captcha-protected-web-application-functionality

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