Bypass google recaptcha for bot test

12,473

Solution 1

It looks like there is a special set of test keys you can use.

If you configure your testing environment to use these keys, reCaptcha will always return a valid response.

Excerpt from the link below:

With the following test keys, you will always get No CAPTCHA and all verification requests will pass.

Site key: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI

Secret key: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

The reCAPTCHA widget will show a warning message to claim that it's only for testing purpose. Please do not use these keys for your production traffic.

https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha-v2-what-should-i-do

Solution 2

As long as you have control over the server:

You can create a if check when validating the captcha on the server side. So when you make the call to google, surround it with an if() check that checks for the current IP, and if it matches a certain IP, or an array of IP's then ignore the validation.

if($_SERVER['REMOTE_ADDR'] !== 'x.x.x.x') {
 //Code that checks captcha and returns error if invalid
}
Share:
12,473
vic0707
Author by

vic0707

Updated on June 12, 2022

Comments

  • vic0707
    vic0707 about 2 years

    Has there anyone come out with a good way to bypass a Recaptcha check in a page to launch a bot test?

    Basically, I want for a particular bot (for which I know the IP address) to bypass a google recaptcha check and not sure what would be the most apropiate way of doing it.

    I have seen this question How to bypass recaptcha human check in nightwatch test? but it does not seem to give a clear anwser.

    Thanks

    EDIT

    I am referring myself to the invisible recaptcha that will show some random images and thus the bot will not know where to click to pass the check.