How to download files in bulk from browser console using JavaScript? -
i have no experience web programming, question simple one. want download lot of files filling out forms in web page. web page's extension .aspx, , interested in 1 field , button. fooling around console in browser, figured out executing:
document.getelementbyid('txtregno').value = 'blahblah`; will fill concerned field. doing
__dopostback("imagebutton1","click"); will download .pdf file curresponding blahblah. actual value needs entered sequence pag-1200 pag-1900. tried using loop, this:
for (var = 21618; < 21621; i++) { document.getelementbyid('txtregno').value = 'b14-' + i; __dopostback("imagebutton1","click"); } but doesnot work expected. last document gets downloaded, , in console:

thought error not come whe ni run in firefox's console, can still run 1 file. tell me how this?
try this:
- inject jquery page via console, explained here: include jquery in javascript console
- in loop clone form, set values wish , submit form
jquery('form').clone().find('#txtregno').val('blah').parent('form').submit();
if page contains more 1 form, should specify it. 'form' works css selectors here. find forms on page. use '#elementid' or '.elementsclassname' more concrete, if necessary.
maybe need change name of form (to able submit forms simulatiously). didn't try it, guess.
if want split code several lines can this:
var myformclone = jquery('form').clone(); myformclone.find('#txtregno').val('blah'); myformclone.attr('name', 'uniquename_' + iterationvariableofforloop); myformclone.submit(); if submit failes, try:
myformclone.get(0).submit(); good luck!
Comments
Post a Comment