Reputation: 37
I have implemented recaptcha v3 on form submit, which works fine on normal scenario as I'm getting 0.9 score. But when I try to run it from a python script using selenium, it still gives me 0.9 score, which is incorrect. I tried recaptcha v2, for the same form, which immediately shows the challenge, when I try to run from a python script. Can you please help me why recaptcha v3 behaves like this?
Invisible recaptcha V2 works fine and prompts the challenge when try running through python script. But v3 always gives 0.9 score
<script src="https://www.google.com/recaptcha/api.js?render=mysitekey"></script>
<script>
$("#myform").on("submit", function(e) {
e.preventDefault();
var form = $("form#myform");
grecaptcha.ready(function() {
grecaptcha.execute('mysitekey', {
action: 'home'
}).then(function(token) {
//Ajax call to server with token and form details
//Validate the token with siteverify at server and make sure the token is valid and score is more than 0.5, to proceed further with the action.
});
});
});
</script>
<form id="myform">
<input type="submit" value="submit" id="btnsubmit" class="g-recaptcha" data-size="invisible" data-sitekey="mysitekey">
</form>
Above code always gets 0.9, even when I run the form through python/selenium script. I have the v2 recaptcha implemented on the same form before, it immediately shows the image challenge, when I run it through scripts.
Upvotes: 4
Views: 1273