Created
August 17, 2023 09:56
-
-
Save ahmedrowaihi/6d8b4c1c7958bdbd619cdc28ae1e0c8c to your computer and use it in GitHub Desktop.
This small code snippet is to fill out the survey form | تخطي الاستبيان
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Github: ahmedrowaihi | |
// HOW TO USE: | |
// OPEN THE browser console | |
// Press [CTRL + SHIFT + I] | |
// THEN COPY PASTE THE CODE BELLOW TO THE CONSOLE AND HIT [ENTER] | |
const elements = Array.from(document.all).filter(element => element.id.endsWith('rbAnswer')); | |
elements.forEach(element => { | |
const radioButtons = element.querySelectorAll('input[type="radio"]'); | |
let targetRadioButton; | |
if (radioButtons.length === 2) { | |
targetRadioButton = radioButtons[1]; | |
} else { | |
const middleIndex = Math.floor(radioButtons.length / 2); | |
targetRadioButton = radioButtons[middleIndex]; | |
} | |
targetRadioButton.click(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment