SkiP TPE Question
all will be select 5—->
// Function to select an option for a given question index and option value
function selectOption(questionIndex, optionValue) {
const questionSelector = `label[for=”Questions_${questionIndex}__Rating”]`; // Replace with the actual selector
const questionLabel = document.querySelector(questionSelector);
if (!questionLabel) {
console.error(`Question label not found for question ${questionIndex + 1}`);
return;
}
const questionElement = questionLabel.parentElement.querySelector(`input[value=”${optionValue}”]`);
if (questionElement) {
questionElement.click();
console.log(`Selected option ${optionValue} for question ${questionIndex + 1}`);
} else {
console.error(`Option not found for question ${questionIndex + 1}`);
}
}
// Selecting the Strongly Agree option (5) for all questions
for (let i = 0; i < 20; i++) {
selectOption(i, “5”);
}