-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path问卷星脚本.txt
40 lines (35 loc) · 2.59 KB
/
问卷星脚本.txt
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
function random(t){
var num = Math.random()*t;
num = Math.floor(num);
return num;
}
//获取全部问题
var father = document.getElementsByClassName("div_question");
//循环遍历问题并随机选择答案
for(var i=0;i<father.length;i++){
var f=father[i];
var uls = f.getElementsByClassName("ulradiocheck");
var lises = f.getElementsByTagName("li");//获取问题选项
var lis=[];
for(var kl=0;kl<lises.length;kl++){
lis.push(lises[kl]);
}
if(lis.length>0){//判断是否有选项
var r=random(lis.length);
if(lis[r].getElementsByClassName('jqCheckbox').length>0){
for(var index=0;index<=r;index++){//多选题,随机选择答案
var flag=random(lis.length);
lis[flag].getElementsByClassName('jqCheckbox')[0].click();
}
}else if(lis[r].getElementsByClassName('jqRadio').length>0){//单选题,随机算则答案
lis[r].getElementsByClassName('jqRadio')[0].click();
}else{
lis[r].getElementsByTagName("input")[0].click();//多余功能
}
}
}
document.getElementById("submit_button").click();//提交
document.location="https://www.toutiao.com/i6638528443141079560/";//重定向问卷页面
https://www.toutiao.com/i6699279549869326860/
document.getElementClassName("c-textarea").click();//提交
document.location="https://www.toutiao.com/i6699279549869326860/";//重定向问卷页面