Skip to content

Instantly share code, notes, and snippets.

@ninlith
Created November 13, 2024 11:15
Show Gist options
  • Save ninlith/c73594ed8477757b361a478acc843759 to your computer and use it in GitHub Desktop.
Save ninlith/c73594ed8477757b361a478acc843759 to your computer and use it in GitHub Desktop.
Click all radios
// @name Click all radios
// @description Selects a random radio button from each uniquely named radio group.
javascript:(() => {
Object.values(Object.groupBy(document.querySelectorAll('input[type="radio"]'), e => e.getAttribute("name"))).forEach((arr) => {
arr[Math.floor(Math.random() * arr.length)]?.click?.();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment