刷新浏览器页面自动登录校园网

刷新浏览器页面自动登录校园网(江西理工大学校园网)

下载安装“油猴”

新建脚本,写脚本

   // ==UserScript==
    // @name         自动登录校园网络
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  try to take over the world!
    // @author       You
    // @match        http://eportal.jxust.edu.cn/1.htm*
    // @match        http://eportal.jxust.edu.cn/a79.htm*
    // @match        http://10.17.8.18/a79.htm*
    // @icon         https://www.google.com/s2/favicons?sz=64&domain=jxust.edu.cn
    // @grant        none
    // ==/UserScript==
    (function() {
        'use strict';
        window.onload = function(){
        // Your code here...
        let usernameInput = document.querySelector("#edit_body > div:nth-child(3) > div.edit_cell.edit_moreTabs.ui-resizable-autohide > div > div.mt_body > div:nth-child(1) > div > form > input:nth-child(4)");
        let passwordInput = document.querySelector("#edit_body > div:nth-child(3) > div.edit_cell.edit_moreTabs.ui-resizable-autohide > div > div.mt_body > div:nth-child(1) > div > form > input:nth-child(5)");
        let savePasswordInput = document.querySelector("#edit_body > div:nth-child(3) > div.edit_cell.edit_moreTabs.ui-resizable-autohide > div > div.mt_body > div:nth-child(1) > div > form > input.edit_lobo_cell.draggable");
        let yidongInput = document.querySelector("#edit_body > div:nth-child(3) > div.edit_cell.edit_moreTabs.ui-resizable-autohide > div > div.mt_body > div:nth-child(1) > div > div.edit_lobo_cell.edit_radio > span:nth-child(4) > input");
        let submitInput = document.querySelector("#edit_body > div:nth-child(3) > div.edit_cell.edit_moreTabs.ui-resizable-autohide > div > div.mt_body > div:nth-child(1) > div > form > input:nth-child(2)");
        if(usernameInput&&passwordInput&&savePasswordInput&&yidongInput&&submitInput){
            // 账号
            usernameInput.value = "XXXXXXXX";
            // 密码
            passwordInput.value = "XXXXXXXX";
            // 选择中国移动网yidongInput
            let clickQueue = [savePasswordInput,yidongInput,submitInput]
            clickQueue.forEach((el)=>{
                el.click();
            })
        }else {
            console.log(usernameInput,passwordInput,savePasswordInput,yidongInput,submitInput)
            //alert("元素已更新,需要更改脚本")
        }}
    })();

脚本代码

文件-保存-启动
启动脚本

  • 11
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值