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:

enter image description here

thought error not come whe ni run in firefox's console, can still run 1 file. tell me how this?

try this:

  1. inject jquery page via console, explained here: include jquery in javascript console
  2. 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

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -