Can we automate CAPTCHA/ReCAPTCHA?
Very straight forward answer is NO.
You don’t, that is the whole idea behind a good CAPTCHA.
CAPTCHA stands for:
Completely Automated Public Turing test to tell Computers and Humans Apart
So, by definition, resolving a CAPTCHA cannot be automated: Otherwise it could not tell computers and humans apart and hence fails being a CAPTCHA.
How to handle a CAPTCHA in a test environment:
- If you need to test an application which uses CAPTCHA, then you need to get the development team to build in a workaround/backdoor which is only active in the test environment.
- Use a service like http://www.deathbycaptcha.com which has an API to return the text of the CAPTCHA for you. Average response is 15 seconds with a result rate of 90% or so they say. Sounds like something to try.
How to deal with CAPTCHA?
-
Either ask dev team for a workaround, like configure CAPTCHA in test environment in such a way it will always accept 1 specific value.
-
Ask developer to disable the CAPTCHA module in testing environment.
-
If your are using custom CAPTCHA module, you can ask developer to generate an API of CAPTCHA generation for testing environment.
-
You can ask dev team to add CAPTCHA code as
title
in markup, then you can access this title and bypass the CAPTCHA, but only in the testing environment.
Most of the time we go with option 1 or 2.
NOTE: When you do work around for CAPTCHA in test environment, You should always have this point in your checklist to make sure workarounds for CAPTCHA testing are removed before it goes on production.
To summarise the above:
- you shouldn’t that’s the point of captcha.
- implement strong AI to mimic human capabilities
- implement a test harness to bypass captcha in your test automation suite
References:
– Stackoverflow – https://sqa.stackexchange.com
– Wiki Pages
Cheers!
Naveen AutomationLabs