-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (39 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const puppeteer = require('puppeteer');
const goodMan = [];
async function auto(person) {
console.log(person);
const browser = await puppeteer.launch({headless: false, defaultViewport: { width: 1600, height: 900 },args: [`--window-size=${1440},${1000}`]});
const page = await browser.newPage();
await page.goto('https://jkxxcj.zjhu.edu.cn/login.html');
await page.waitFor(5000)
await page.type('#zgh', person.user)
await page.type('#mm', person.password)
await page.waitFor(2000)
await page.click('#loginBtn')
await page.waitFor(5000)
await page.click('#jkbg')
await page.waitFor(10000)
await page.click('#saveBtn')
await page.waitFor(5000)
await page.click('.layui-layer-btn0')
await page.waitFor(5000)
await page.click('.person')
await page.waitFor(2000)
await page.click('#logout')
await page.waitFor(5000)
await browser.close();
}
const interval = setInterval(()=>{
const nowHours = new Date().getHours()
console.log(nowHours);
if(nowHours === 14) {
clearInterval(interval)
main()
}
}, 30*60*1000);
async function main() {
for (let i = 0; i < goodMan.length; i++) {
await auto(goodMan[i])
}
console.log('完成')
}