Created
August 6, 2024 14:30
-
-
Save nsdevaraj/6d046fc6579c299756efa649ba8e08d3 to your computer and use it in GitHub Desktop.
Automation
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
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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