Reputation: 2470
I'm implementing an invisible reCAPTCHA as per the instructions in the documentation: reCAPTCHA V2 documentation
I've managed to implement it without any problems. But, what I'd like to know is whether I can simulate being a robot for testing purposes?
Is there a way to force the reCAPTCHA to respond as if it thought I was a robot?
Thanks in advance for any assistance.
Upvotes: 81
Views: 53313
Reputation: 8143
Update: This might not work in new versions of Chrome (see comments).
In the Dev Tools, open Settings
, then Devices
, add a custom device with any name and user agent equal to Googlebot/2.1
.
Finally, in Device Mode, at the left of the top bar, choose the device (the default is Responsive
).
You can test the captcha in https://www.google.com/recaptcha/api2/demo?invisible=true
(This is a demo of the Invisible Recaptcha. You can remove the url invisible
parameter to test with the captcha button)
Upvotes: 63
Reputation: 4189
All I had to do was use an incognito window in order to trigger a recaptcha.
I tried using the emulator and that never worked for me.
Upvotes: 1
Reputation: 2139
If you only want to simulate what you would get in the backend, then an option is to temporarily disable JavaScript in your browser.
This causes the reCAPTCHA to not be shown on your web page. Then when you perform some action on the page, causing a POST, the backend code will not receive the g-recaptcha-response
form field and the Captcha validation will fail.
Upvotes: 1
Reputation: 682
As of 2023, the new correct answer to this is a little simpler than one might think. User agent and device simulation no longer trigger Recaptcha, but in order to trigger the verification all one has to do is act like a bot.
Here is the invisible Recaptcha demo page: https://www.google.com/recaptcha/api2/demo?invisible=true
Submit that form ~10 times, and it'll start showing you verifications. The form is prefilled so it's just a matter of Submit, Back, Submit, Back. Then, you can go back to the site you're testing, and Google will recognize you as the same person who requires verification.
Upvotes: 1
Reputation: 4130
None of proposed answers worked for me. I just wrote a simple Node.js script which opens a browser window with a page. ReCaptcha detects automated browser and shows the challenge. The script is below:
const puppeteer = require('puppeteer');
let testReCaptcha = async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.goto('http://yourpage.com');
};
testReCaptcha();
Don't forget to install puppeteer by running npm i puppeteer
and change yourpage.com
to your page address
Upvotes: 2
Reputation: 960
For Firefox, if you don't want to install any add-ons, you can easily manually change the user agent :
I tried this with Recaptcha v3, and it indeed returns a score of 0.1
And don't forget to remove this line from about:config when done testing !
I found this method here (it is an Apple OS article, but the Firefox method also works for Windows) : http://osxdaily.com/2013/01/16/change-user-agent-chrome-safari-firefox/
Upvotes: 7
Reputation: 4126
Just completing the answer of Rafael, follow how to use the plugin
Upvotes: 2
Reputation: 39
I find that if you click on the reCaptcha logo rather than the text box, it tends to fail.
This is because bots detect clickable hitboxes, and since the checkbox is an image, as well as the "I'm not a robot" text, and bots can't process images as text properly, but they CAN process clickable hitboxes, which the reCaptcha tells them to click, it just doesn't tell them where.
Click as far away from the checkbox as possible while keeping your mouse cursor in the reCaptcha. You will then most likely fail it. ( it will just bring up the thing where you have to identify the pictures).
The pictures are on there because like I said, bots can't process images and recognize things like cars.
Upvotes: 3
Reputation: 49
yes it is possible to force fail a recaptcha v2 for testing purposes.
there are two ways to do that
First way :
you need to have firefox browser for that just make a simple form request and then wait for response and after getting response click on refresh button firefox will prompt a box saying that " To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. " then click on "resend"
by doing this browser will send previous " g-recaptcha-response " key and this will fail your recaptcha.
Second way
you can make any simple post request by any application like in linux you can use curl to make post request.
just make sure that you specify all your form filed and also header for request and most important thing POST one field name as " g-recaptcha-response " and give any random value to this field
Upvotes: 3
Reputation: 450
You can use a Chrome Plugin like Modify Headers and Add a user-agent like Googlebot/2.1 (+http://www.google.com/bot.html).
Upvotes: 31