【问题标题】:Automatically click recaptcha box in electron with Javascript使用Javascript自动单击电子中的recaptcha框
【发布时间】:2019-08-25 16:03:42
【问题描述】:

我试图在我的 javascript 代码中设置一个 autoclick 函数,该函数将在调用时单击我的电子窗口中的 recaptcha。我查看了一个 google chrome 扩展程序,它成功地自动单击页面上的 recaptchas,它们的简单代码在 github 上。当我试图将他们的代码实现到我的电子窗口中时,它永远不会成功。这是与电子有关还是我做错了什么?

这是他们的代码。

let isRecaptchaFrame = () => {
  return /https:\/\/www.google.com\/recaptcha\/api2\/anchor/.test(window.location.href);
};

let captchaInterval = setInterval(() => {
  if (isRecaptchaFrame()) {
    clearInterval(captchaInterval);
    document.getElementsByClassName('recaptcha-checkbox-checkmark')[0].click();
  }  
}, 500);

【问题讨论】:

  • 编辑:我想通了
  • 你发现了什么?你能添加你的发现吗!

标签: javascript html electron captcha


【解决方案1】:

Electron 是基于 Node.js 构建的,因此您无法访问窗口 api。尝试这个: https://electronjs.org/docs/api/browser-window

【讨论】:

    猜你喜欢
    • 2021-11-27
    • 1970-01-01
    • 2011-08-04
    • 2014-12-28
    • 2023-03-08
    • 2017-02-06
    • 2022-10-30
    • 1970-01-01
    • 2017-02-12
    相关资源
    最近更新 更多