会游泳的猴子 发表于 2021-12-10 23:00:51

有一个网站,刚进去会有一个弹窗,想自动关闭,但无效

本帖最后由 会游泳的猴子 于 2021-12-10 23:06 编辑

小白初学,地址: https://stable.getautoclicker.com/


尝试click无效,各位大佬帮忙看看该怎么才能点到 close按钮呢?






Ne-21 发表于 2021-12-10 23:59:28

本帖最后由 Ne-21 于 2021-12-11 00:25 编辑

``

```javascript
// ==UserScript==
// @name                New Userscript
// @namespace         https://bbs.tampermonkey.net.cn/
// @version             0.1.0
// @description         try to take over the world!
// @author            You
// @match               *
// @run-at            document-end
// ==/UserScript==

Element.prototype._addEventListener = Element.prototype.addEventListener;
Element.prototype.addEventListener = function () {
    let args = [...arguments]
    let temp = args;
    args = function () {
      let args2 = [...arguments];
      args2 = Object.assign({}, args2)
      args2.isTrusted = true;
      return temp(...args2);
    }
    return this._addEventListener(...args);
}
```

cxxjackie 发表于 2021-12-11 00:08:45

react页面,有isTrusted检测:
const closeButton = document.querySelector('.modal-footer > button:nth-child(1)');
const prop = Object.keys(closeButton).find(p => p.startsWith('__reactEventHandlers'));
closeButton.onClick({isTrusted: true});

会游泳的猴子 发表于 2021-12-11 09:57:37

Ne-21 发表于 2021-12-10 23:59
``

```javascript


学习到了,灰常感谢!!!

会游泳的猴子 发表于 2021-12-11 09:58:01

cxxjackie 发表于 2021-12-11 00:08
react页面,有isTrusted检测:

学习到了,灰常感谢!!!
页: [1]
查看完整版本: 有一个网站,刚进去会有一个弹窗,想自动关闭,但无效