-
Notifications
You must be signed in to change notification settings - Fork 0
/
judge.js
62 lines (50 loc) · 1.64 KB
/
judge.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const sleep = ms => new Promise(r => setTimeout(r, ms));
function allgood(){
let matches=document.evaluate('//div[@id="txwj-index-card"]//label[text()[contains(.,"很好")]]//input[@type="radio"]', document, null, XPathResult.ANY_TYPE, null)
let good=matches.iterateNext()
while(good){
good.checked=true
good=matches.iterateNext()
}
}
async function submit(){
let submit=document.evaluate('//footer[@id="txwjFooter"]//a[text()[contains(.,"提交")]]', document, null, XPathResult.ANY_TYPE, null).iterateNext()
submit.click()
await sleep(200)
let confirm=document.evaluate(
'//a[text()[contains(.,"确认")]]',
document, null, XPathResult.ANY_TYPE, null
).iterateNext()
confirm.click()
await sleep(4000)
let no_recommend=document.evaluate(
'//div[@id="buttons"]//button[text()[contains(.,"暂不推荐")]]',
document, null, XPathResult.ANY_TYPE, null
).iterateNext()
if(no_recommend) no_recommend.click()
await sleep(200)
let no_tas=document.evaluate(
'//div[@class="bh-dialog-btnContainerBox"]//a[text()[contains(.,"暂时不评")]]',
document, null, XPathResult.ANY_TYPE, null
).iterateNext()
if(no_tas) no_tas.click()
}
async function next(){
let next=document.evaluate(
'//section[@class="ckdwpj"]//div[@class="card-btn blue"]',
document, null, XPathResult.ANY_TYPE, null
).iterateNext()
if(next==null){
return false
}
next.click()
return true
}
async function main(){
while(await next()){
await sleep(1000)
allgood()
await submit()
}
}
await main()