调用Hcaptcha回调函数的问题

问题描述

我来看你是因为我已经阻止了一个星期向 Google 发送 hcaptcha 回复

在上下文中,我正在releases.footshop.com 网站上使用Selenium 在Python 中开发一个Web 自动化程序。
验证码位于表格末尾,应激活“完成订单”按钮

我设法检索了对 2 个验证码发送的 hcaptcha 的响应,然后将其放入 h-captcha 文本框中。 但无法发送。

根据hcaptcha文档,在POST请求中调用了回调函数。 我找到了这个函数,它是 hcaptchaOnLoad: https://hcaptcha.com/1/api.js?render=explicit&onload=hcaptchaOnLoad

我还找到了定义 hcaptcha 函数调用 hcaptchaOnLoad 的 index.js 文件https://pastebin.com/8MZb0P0B

// Generate hCaptcha API Script
var CaptchaScript = function CaptchaScript(hl,reCaptchaCompat) {
  // Create global onload callback
  window.hcaptchaOnLoad = function () {
    // Iterate over onload listeners,call each listener
    onLoadListeners = onLoadListeners.filter(function (listener) {
      listener();
      return false;
    });
  };

我附上了我能够在 Chrome 控制台和 Firefox 中进行的测试以及我的 2captcha 代码

Chrome tests

Firefox tests

Python code

问候,
玛特

解决方法

试试这个。可能有帮助 https://2captcha.com/blog/hcaptcha-cloudflare-en 使用他们的插件,我可以绕过 hcaptcha 但是回调函数名一直在变 所以我无法在代码中调用它。