I am trying to skip questionnaire automatically to see my exam marks easily. Because I don't want to do this manually for each exam. So I am writing a script to do that.
setTimeout(function(){
$(".btn-danger:eq(0)").click();
setTimeout(function(){
$(".multiselect:eq(0)").click().first();
setTimeout(function(){
$('.checkbox input[type=checkbox]').prop('checked', true).click();
}, 2000);
setTimeout(function(){
$(".multiselect:eq(1)").click().next();
$('.checkbox input[type=checkbox]').prop('checked', true).click();
}, 2000);
setTimeout(function(){
$(".multiselect:eq(2)").click().next();
$('.checkbox input[type=checkbox]').prop('checked', true).click();
}, 2000);
}, 5000);
});
There is many radiobuttons, textboxes and multiple dropdown list with checkbox. Everything is ok except the multiple dropdownlist with checkboxes.
This code selecting all of the options like this:
[dropdownlist][1]
[1]: https://i.sstatic.net/SuCXk.jpg
There is 2 more dropdownlist here. Code select all of the options in order. When the first one ok, then the second one runs. But the first one's values getting unselected. When the third one runs the second one getting unselected too. Only the last one works correctly.
How can I achive my goal?
setTimeout()is not blocking. The callbacks of the "inner"setTimeout(..., 2000)calls are all executed at the same time.setTimeout(..., 1000)the second 2000, third 3000. When I clear the timeouts they not working orderly. only the last one works. The others do nothing. How can I do it seperately in one time.