asp.net - javascript skips steps and executes last command only -
can please me on js scraper coding tried create website uses asp-like coding...
we use website download our latest software training manuals, , there more 50 manuals have download clicking on each item every time. download managers won't work, these pdfs linked __dopostback() nodes. if use coding 1 entry only, works perfectly, moment start batching command, skips __dopostback
until last entry has been reached, , executes 1 only. i've tried adding sleep command slow down process if issue, did, sleep script x-ms , skip task of saving file loop again.
note: i'm not experienced javascript, there may few issues coding below, , appreciated educating myself!
i'm using google chrome , javascript console run below script:
//sleep function found on stackoverflow slow down script cmdlet function sleep(milliseconds) { var start = new date().gettime(); (var = 0; < 1e7; i++) { if ((new date().gettime() - start) > milliseconds){ break; } } } // node starts index 2, start there avoid errors var = 2; while (i <= 15){ console.log (i); // execute __dopostback(...) depending on int values switch(i){ case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: var cmdlet = "gridviewlevel3$ctl0" + + "$lnkfolder3"; console.log (cmdlet); __dopostback(cmdlet,''); sleep(6000); break; case 10: case 11: case 12: case 13: case 14: case 15: var cmdlet = "gridviewlevel3$ctl" + + "$lnkfolder3"; console.log (cmdlet); __dopostback(cmdlet,''); sleep(6000); break; default: console.log("error!"); //handle exceptions here... break; }; = + 1; }
Comments
Post a Comment