首页 > 解决方案 > Recaptcha V3 在通过 python 脚本运行时总是返回 0.9 分

问题描述

我已经在表单提交上实现了 recaptcha v3,它在正常情况下工作正常,因为我得到了 0.9 分。但是当我尝试使用 selenium 从 python 脚本运行它时,它仍然给我 0.9 分,这是不正确的。我尝试使用相同形式的 recaptcha v2,当我尝试从 python 脚本运行时,它立即显示了挑战。你能帮我解释一下为什么recaptcha v3会这样吗?

Invisible recaptcha V2 工作正常,并在尝试通过 python 脚本运行时提示挑战。但是 v3 总是给出 0.9 分

<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>

上面的代码总是得到 0.9,即使我通过 python/selenium 脚本运行表单。我之前在相同的表单上实现了 v2 recaptcha,当我通过脚本运行它时,它会立即显示图像挑战。

标签: recaptchainvisible-recaptcharecaptcha-v3mvcrecaptchagrecaptcha

解决方案


推荐阅读