如何使用 phpunit test 输入验证码数据
是否可以通过phpunit测试输入验证码信息?
类似的东西
$this->type("recaptcha_reponse_field", "里面的信息");
我知道验证码是为了防止此类事情而创建的,但我确信有人曾经必须自动测试一个系统,该系统在提交表单之前需要验证码信息。
谢谢 啊~~~
Is it possible to enter the captcha information with phpunit tests?
something like
$this->type("recaptcha_reponse_field", "information inside");
I understand that captcha were created to prevent this kind of things, but i'm sure some1 out there once had to test a system automatically which needs captcha information before submiting the form.
Thanks
D~~~
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能这样做,除非你 OCR 验证码图像。但这不再是一个测试:)
通常在服务器端实现某种绕过。在伪代码中,它看起来像:
然后您需要确保“bypass_captcha”永远不会在您的公共服务器上启用。
当然,还有其他方法 - 例如禁用给定 IP 地址(属于运行测试的主机)的验证码检查
You can't do that, unless you OCR the captcha image. But then that is no longer a test :)
Usually some kind of bypass is implemented on server side. In pseudocode it would look like:
Then you need to ensure that "bypass_captcha" is never enabled on any on your public servers.
Of course, there are other ways too - like disabling captcha check for a given IP address (that belongs to the host from which you run the test from)