Test invisible recaptcha - recaptcha

We have integrated invisible recaptcha in one of our websites. Whenever we submit the form it automatically submits.
I read in some google groups that we would get a challenge when accessed on edge browser. But for us, it is automatically submitted.
Any specific steps to test the invisible recaptcha?

You can test invisible recaptcha by using Chrome emulator.
You will need to add a new custom device (BOT) in developer tools, and set User Agent String to Googlebot/2.1 on Desktop. Then use the new BOT device when testing on your site to trigger the recaptcha authentication.
Note: ReCaptcha v3 will still let the google bot pass as it has a score of 0.9 when emulating in Chrome.
V2 INVISIBLE
In this case just use Incognito or Private browsing to see it works.
Here is the testing link where ReCaptcha is working:
https://www.google.com/recaptcha/api2/demo?invisible=true
Please give the credits to the guys in comments below.

I found an excellent answer that works as of 2018-08-27.
In Chrome, hit F12 to open the Developer Console. Next, toggle the Device Toolbar, select a device and click Edit... Now, add a new device with the following configuration:
Once you hit save and use the new device, the ReCaptcha should open a modal requiring the user to match images.
Credit: This answer was originally posted on https://www.tectite.com/fmhowto/test-invisible-recaptcha.php?WWWTECTITE=p32j2na5otc4rmtbmfsmf9rci6

May 2021
Everyone was talking about using the demo page to test it out. What we get after we tested and how it should looks like is what everyone miss out. Or probably thats why most of us are still searching for the answer.
Even though this question is 3yrs old, still its not clear how this recaptcha works. Iam trying my best to break in steps. Let me know if its works for you.
Google Demo page test
Important
Follow the steps below in the Incognito window
with the parameter
Go to this url https://www.google.com/recaptcha/api2/demo?invisible=true (notice the url has ?invisible=true parameter at the end)
You should see nothing but an pre-filled form with an active 'submit' button with no 'checkbox' captcha, instead you will see the badge at the bottom right.
Click the 'Submit' button and you should see something like this. This is the verification check point.
4. Select the relevant image and the page should redirect with the message saying
Verification Success... Hooray!
But what if you didn't see any image?
If you are not seeing any verification image and the form submits with
Verification Success... Hooray!
then either the form is not working (mostly that's not the case) or you need to clear your browser cache and try again.
without the parameter
Go to this url, https://www.google.com/recaptcha/api2/demo (notice, i have removed the ?invisible=true parameter from the url)
You should see the good 'ol robot checkbox captcha above the 'Submit' button.
3. Also you can notice there won't be captcha badge at the bottom right.
Your Website
Try it in the Incognito window
Just like the demo you should get the same result in your website if you use invisible captcha. (Don't worry about the url parameters)
If your page displayed the captcha badge at the bottom right then after clicking the 'submit' button you should see the popup image window.
If you do not get any popup and the form submits then there's an issue with your captcha or could be browser cache.
Not seeing the checkbox ... ?
Here are some notes from reCaptcha help page - https://support.google.com/recaptcha#6223828
If you're seeing this reCAPTCHA challenge, your browser environment doesn't support the reCAPTCHA checkbox widget.
There are a few steps you can take to improve your experience:
Make sure your browser is fully updated (see minimum browser requirements)
Check that JavaScript is enabled in your browser
Try disabling plugins that might conflict with reCAPTCHA
Please note that some sites may have incorrectly integrated with reCAPTCHA - in this case please contact the site's webmaster.
WordPress Contact Form 7 users
You do not need to add the [recaptcha] tag.
reCAPTCHA v3 doesn’t need a CAPTCHA widget (the “I’m not a robot” checkbox used in reCAPTCHA v2) to work, so [recaptcha] form-tags are no longer necessary. If [recaptcha] form-tags are found in a form template, Contact Form 7 5.1 or higher ignores them and replaces them with an empty string.
https://contactform7.com/recaptcha/

As of 2019-06-21, it appears that it is sufficient with Google Chrome (v74.0.3729.169) to bring up a new incognito window to force the recaptcha to execute. (I had needed this for our own recaptcha testing, so I'm glad I found it.)

I am still struggling a little bit with this but I found that the following things make invisible recaptcha puzzle more likely to appear:
Log into the recaptcha admin and set it to maximum security
Open your site from an incognito tab.
Sometimes leaving the login page open and trying to login after some time has passed seems to trigger the recaptcha puzzle.
I must admit though that these don't work all of the times and there are times that I really struggle to get it to work.
Update: It seems a bit strange but I have found that the invisible ReCaptcha is more likely to appear when I submit a form using the Enter key instead of pressing a button with the mouse.

Invisible recaptcha check fails if you try to access your page via automated tests (in my case chrome browser) since chrome has a feature to recognize if the browsers is controlled by such software... so try to create easy tests in Python or Java(+webdriver), to see if recaptcha is implemented correctly.

If you did not implement the code yourself, the first thing to check is the source code, see if reCaptcha is actually loaded. When using a CMS, I search for this line (or similar):
script type='text/javascript' async defer src='https://www.google.com/recaptcha/api.js?onload=renderInvisibleReCaptcha&render=explicit&hl=de-CH'

If you have the luxury of a VPN, switch to a bad rep IP or country or an IP commonly used for P2P. This works for me most of the time.

Go thru the steps to test the re-captcha with dev tools open. Go to the network tab and find the POST where the form is submitted. Right click that line and copy as cURL.
Paste into the CLI and voila, you get the failure and the output of the cURL is the HTML that the server sent back.

2022 Answer that worked for me!
Please do give this one a go as it's the only one that actually worked for me after hours of testing.
Go to your reCAPTCHA admin account: https://www.google.com/recaptcha/admin/
Go to your site settings
Move the "Security Preference" slider all the way to the right to make reCAPTCHA trigger more often
Open an Incognito window, or even better a secure web browser with a built in encrypted proxy (I think this makes reCAPTCHA more suspicious of your browser) - I used a browser call Epic Browser, which is also Chromium based: https://www.epicbrowser.com/. Note: Just using Incognito on Chrome did not work for me, hence why I went to go use Epic.
Attempt to submit your form - you should hopefully receive the popup check!
As others mentioned you can also test if the browser alone triggers reCAPTCHA check by going to https://www.google.com/recaptcha/api2/demo?invisible=true and submitting the form.
This finally helped me as I was going crazy thinking my reCAPTCHA setup was not working and that I coded something wrong... But no, it was working! Just not very suspicious apparently.
I hope this helps someone as it did me!

The way I tackled it:
Go to your POST to google.com/recaptcha/api/siteverify
Before the response is returned, set the success property in the response to false.
I'm using Guzzle in Laravel (thanks to this example):
$response = $client->post('https://www.google.com/recaptcha/api/siteverify', [
'query' => [
'secret' => env('RECAPTCHA_V3_SECRET_KEY'),
'response' => $value,
'remoteip' => $_SERVER['REMOTE_ADDR'],
]
]);
$body = $response->getBody();
$contents = json_decode($body->getContents());
$contents->success = false;
return $contents;

Related

Remove domain from reCAPTCHA service

I signed up at https://www.google.com/recaptcha/admin when I was setting up a forum page at mysite.com/forum but the method I used added a badge to the bottom right of every page on my site.
The badge looks like this right here.
I dislike the badge and my mobile users are very frustrated about it.
In an effort to remove it, I clicked the trash icon to delete my domain from the reCAPTCHA Admin Console area on Google. Two days later and it hasn't gone away.
I don't even use the forum anymore, yet somehow Google is able to insert an iframe onto every page of my site for some kind of invisible reCAPTCHA.
I didn't add any code to my site. I don't understand how they are doing this. It even shows on Firefox. When I search for how to remove the badge, I only see CSS solutions.
I do not want a CSS solution. I want it permanently gone. As if I never added my domain to their service. Maybe there is a specific amount of time before their service knows I deleted my domain from it?
My site uses Cloudflare and on the first visit you see the badge. Note that I am NOT talking about the challenge page.
How do I remove the "protected by reCAPTCHA" badge without using CSS?
remove
reCAPTCHA
من ال login
from cpanal

reCaptcha google chrome Spring MVC double submit issue

I am using Spring MVC 3, and JSP/JSTL for the view. I have incorporated reCaptcha in my form. I am noticing some very strange behaviour that is not consistent (i.e. it doesn't happen all the time, it's random) when I submit my form. This ONLY happens with Google Chrome.
I have searched the web but was not able to find any information about this problem.
Basically, when I submit my form including a valid captcha, I am bounced back to the form page YET the captcha was VALID. I got lucky and was able to debug it once and saw the captcha was valid, but the flow of control is somehow being intercepted DESPITE it executing the return ModelAndView logic.
So in other words, it should return a ModelAndView controller with the new view in it, but instead the flow of control goes back to the top of the function!!! and it hits the recaptcha code BUT by this time the recaptcha code is invalid, so it says FALSE. THEN it goes back to the original form page. What is frustrating about this is there is a commit to my production database that happens because the captcha was originally valid and other valid logic that is executed as per normal behaiour.
The reCaptcha box is the only box marked with an error and it states that you must re-enter the code. The only major issue is even if my reCaptcha was bad, it should come back immediately and say try again, which it does, but it SHOULD not appear as valid, highjack the flow of control and then redirect back to the form page.
The end result is I get 2 exact records in the database because the user submits again. It only happens in this way. i.e. I haven't come across a scenario when you have to submit 3 times or more.
This is ONLY happening in google Chrome. I have tried this on firefox and IE but I have never seen this issue. Someone in another country just submitted information via this form and I asked them what browser they were using, and they confirmed it was chrome! I too have had enough encounters with this issue to know it actually is an issue.
Does anyone know why the flow of control goes back to the top of the function?? One other thing I noticed is the flow of control doesn't always go to the bottom, it's like it's got a mind of its own. One other time I was stepping through and it just jumped to the top.
ANY HELP would be kindly appreciated as I am trying to figure this out in a production system!!
Thanks!!

Does Watir-Webdriver support clicking on links where the destination is a javascript?

I am new to Ruby and Watir-Webdriver. I have a suite of automation for our site written in VBScript and I want to convert it to Ruby/Watir because I now have to support Firefox. I've found I really like Ruby, and I'm working on Watir, but I've spent a week now trying to get Webdriver to even display my login screen.
The site begins with a "Warning screen" with an "I agree" area. The user click on the I agree and is presented with a login screen.
<body onload="showMessage('true')"><div id="login"><div id="message"><map name="accept">
<area href="javascript:showLogin();" shape="rect" coords="280,390,384,432" />
</map></div></div></body>
I need to click the area to present the login screen (which is the same page, a form really, just hidden). I do this all day long with VBScript:
objExplorer.Document.GetElementsByTagName("area")(0).click
However, using Watir-Webdriver, browser.area(:index, 0).click does nothing.
puts browser.area(:index, 0).shape
=>RECT
puts browser.area(:index, 0).coords
=>280,390,384,432
So, I know the script can "see" the area element and read its attributes. It just doesn't do anything with the click event.
If I use a browser.goto on the href itself:
browser.goto("javascript:showLogin();")
the login becomes visible, but I cannot interact with the elements (set the text fields for user name and password). I'm looking at the page with the developer tools window open (to view the HTML) and it just says "Loading...".
This is where I am stuck. Interestingly, if I use the login form's name and do a:
browser.form(:name, "LoginForm").submit
I get the popup message from the form that the user name and password are blank, so there is still some interaction.
Of course, if I manually enter the user name/password, I can submit the form fine even if it says "Loading...".
I understand "when_present.click" and other techniques for waiting for the browser; these don't work. My dilemma is I can't click the area, and if I use the goto on the javascript, the browser then ignores the automation from Watir.
Thanks for your help. Even an answer of "Sorry, Watir or Webdriver won't do this" is acceptable to me. It will allow me to move on and look for other solutions.
Edit after questions in comments:
Sorry, the site is not public, so I can't post a link.
As for working in Firefox, the script works just fine. IE is having the issue. The comments got me thinking: I do get a "...certificate not issued by trusted..." certificate error upon first navigating to the site. Could the certificate error I get in IE cause some sort of disconnect to the automation before presenting the form? I use a line I got here on stackoverflow to click past the cert error:
browser.goto("javascript:document.getElementById('overridelink').click()")
But now I think maybe this might be a part of the issue. I have gone to my IE (using IE 9) options and unchecked the security options for checking certs, but to no avail. If this may be causing the issue, I'll have to go negotiate with the infrastructure team to generate certificates for us to download each time they build a new server.
Ok, I guess after reading hundreds of posts and hours of Google searches I finally found a solution to my issue: browser.execute_script.
browser.execute_script("showLogin();")
It was that simple. Using browser.goto hung on loading the page and webdriver timed out. Using execute_script works perfectly!

fb:comments and iframe apps

I've got a FB fan page with an application tab. Application canvas type is Iframe, not FBML. What I want is the ability for a user to comment on the info I put in that tab (simple fb comments form that you can add in your app or website). Now, <fb:comments> works for "Like" action, but fails to post any coments. The form itself is visible, but when you click "post", nothing happens.
I define xid, returnurl, showform, canpost params", tried various samples, and it still doesn't work - no error is shown, but no action whatsoever. I'd put the social plugin in there but FB strips off the scripts or iframes even if they're from the same (facebook) domain. If it helps, here's the sample code I've used:
<fb:comments xid="veryuniqueid_123" canpost="true" candelete="true" numposts="5" showform="1" publish_feed="0" simple="1" reverse="1"></fb:comments>
Any ideas anyone?
Thanks,
d.
Solved
Loaded JS SDK from https://developers.facebook.com/docs/reference/javascript/ , then added the code provided by facebook in https://developers.facebook.com/docs/reference/plugins/comments/ , "XFBML" version (since iframe isn't supported and HTML5 is a bit too early).

Cross Domain Iframe AJAX Hash History IE6/7

We are using document.domain to sort out our cross domain stuff. Recently I decided to start working on a hash system on our website so there is history in the browser and bookmark links etc.
After some time google'ing I found reallysimplehistory and decided to give it a try. It works outstanding in IE8 and Chrome etc. I run into my problem in IE6 and 7 where it needs to use an IFrame to simulate history changes.
When I hit the back button in the browser it "goes back" a page but it never changes the hash in the url like it should. It has the correct number of history pages and it changes the hash when I add a new hash, but the backward and forward buttons of the browser aren't changing it.
Using the demo they supplied it was working just fine in IE6/7. When I introduced document.domain to the demo it stopped working and gave the same results my website gave.
So what do I need to do to get the back/forward buttons working in the browser again?
It might not be what you're looking for but I'd at least recommend looking at jquery-bbq which is a back functionality jquery plugin. You might be able to steal something from the source or base your app on it.

Resources