Created
July 24, 2019 14:33
-
-
Save 5hanth/9d0e5bbf18eaa7217822cbe37f01b16d to your computer and use it in GitHub Desktop.
auto scrap all sub div in a survey https://eservices.tn.gov.in/eservicesnew/land/chitta.html?lan=en
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
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