Skip to content

Instantly share code, notes, and snippets.

@nsdevaraj
Created August 6, 2024 14:30
Show Gist options
  • Save nsdevaraj/6d046fc6579c299756efa649ba8e08d3 to your computer and use it in GitHub Desktop.
Save nsdevaraj/6d046fc6579c299756efa649ba8e08d3 to your computer and use it in GitHub Desktop.
Automation
let randomLoop = 8;
let parentContainer = document.getElementsByClassName("scrollRegion");
 
const getRandomNumber = (min, max) => {
  return Math.floor(Math.random() * (max - min + 1) + min);
};
 
function task(index) {
  if (index >= randomLoop) return;
  let parent = document.getElementsByClassName("scrollRegion")[1];
  let childs = parent.getElementsByClassName("slicerCheckbox");
  const randomNumber = getRandomNumber(0, childs.length - 1);
  console.log("Random number ==> ", randomNumber);
  childs[randomNumber].click();
  setTimeout(() => task(index + 1), 3000);
}
 
for (let i = 0; i < parentContainer.length; i++) {
  task(0);
  break;
}
@nsdevaraj
Copy link
Author

randomLoop - denotes the iteration ,how many times it has to click

let parent = document.getElementsByClassName("scrollRegion")[1];
 
 
all the slicers/field parameters are under scrollRegion class , so depending on the index, we can use 1,2...so on

setTimeout to change the interval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment