Skip to content

Instantly share code, notes, and snippets.

@5hanth
Created July 24, 2019 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5hanth/9d0e5bbf18eaa7217822cbe37f01b16d to your computer and use it in GitHub Desktop.
Save 5hanth/9d0e5bbf18eaa7217822cbe37f01b16d to your computer and use it in GitHub Desktop.
var proc = (count, index) => {
let submitBtn = document.evaluate(`//*[@id="auto_off"]/table[4]/tbody/tr[5]/td[2]/input`,document).iterateNext()
let selectInput = document.evaluate(`//*[@id="subdiv"]/tbody/tr[5]/td[2]/select`, document).iterateNext()
let options = selectInput.options
let indexInt = parseInt(index)
let currentOption = options[indexInt]
if(currentOption && currentOption.value == selectInput.value) {
if((indexInt - 1) < options.length) {
console.log(`click `, options[indexInt+1])
selectInput.selectedIndex = indexInt+1
submitBtn.click()
if(count < 0){
console.log(`end of tabs count`)
return;
} else {
setTimeout(() => { proc(count-1, index+1); },1000);
return;
}
}
} else {
setTimeout(() => { proc(count-1, index+1); },1000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment