// ==UserScript== // @name weihl_test // @namespace http://tampermonkey.net/ // @version V0.1 // @description open one's eyes to see the world. // @author weihule // @match https://pmos.sd.sgcc.com.cn:18080/trade/main/index.do* // @icon https://www.google.com/s2/favicons?sz=64&domain=google.com // @grant none // @license AGPL-3.0 // @downloadURL none // ==/UserScript== (function() { 'use strict'; window.addEventListener('load', function() { alert('Hello World'); // 查找并切换到特定的 iframe const iframe = document.querySelector("iframe[@class='body-iframe']"); if (iframe) { iframe.contentWindow.document.body; } console.log('0000000000000000000000000000 看这里'); // 模拟等待时间 setTimeout(() => { // 查找弹窗元素 const popupWindow = document.querySelector("//div[@id='logModal']//div[@class='modal-dialog modal-lg']"); if (popupWindow) { // 找到关闭按钮 const closeButton = popupWindow.querySelector(".//div[@class='modal-header']/button[@class='close']"); if (closeButton) { closeButton.click(); } } }, 10000); // 等待 10 秒,可根据实际情况调整等待时间 }); })();