Created
July 2, 2016 01:03
-
-
Save irisli/b767dab7cdf1bfde70e124e4145a97b5 to your computer and use it in GitHub Desktop.
Batch form filler
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
// Batch form filler to be used in the console | |
formValues = [ | |
['foo','bar'], | |
['bar','baz'], | |
['baz','blah'], | |
['blah','blahblah'], | |
['wibble','wobble'], | |
['flob','wubble'], | |
] | |
// Luckily for this case, the form I wanted to fill used id's to mark the form elements | |
$zero = document.querySelector('#old'); | |
$one = document.querySelector('#target input'); | |
$submit = document.querySelector('#submit'); | |
var i = 0; | |
var submitChange = function() { | |
if (i >= formValues.length) { | |
return; | |
} | |
var currentValue = formValues[i]; | |
$zero.value = currentValue[0]; | |
$one.value = currentValue[1]; | |
$submit.click(); | |
i++; | |
setTimeout(submitChange, 1000); | |
}; | |
submitChange(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment