marcar todos

Automatically select a specific radio button on the ASI Web page

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         marcar todos
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically select a specific radio button on the ASI Web page
// @author       ils94
// @match        https://asiweb.tre-rn.jus.br/asi/web?target=com.linkdata.patrimonio.bem.web.ConsultaGeralGateway&action=start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let outerInterval;

    // Function to select the radio button
    function selectRadioButton() {
        console.log('Attempting to find the radio button...');

        var xpath = "/html/body/div[2]/div[3]/form/div[1]/div[2]/div[2]/fieldset/ul/li/span/span[4]/input";
        var radioButton = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

        if (radioButton) {
            console.log('Radio button found. Starting action loop...');
            var actionInterval = setInterval(function() {
                radioButton.checked = true;
                console.log('Radio button checked.');
                if (radioButton.checked) {
                    clearInterval(actionInterval);
                    clearInterval(outerInterval);
                    console.log('Radio button successfully checked.');
                }
            }, 500);
        } else {
            console.log('Radio button not found. Retrying...');
        }
    }

    // Start the initial loop
    outerInterval = setInterval(selectRadioButton, 500);

})();