I need to load 1000 urls on a tracking/reporting app (after authenticating via an HTML form) and trigger a “resubmit” javascript function. Unfortunately there is no bulk action to handle all at once so I’m left with automation. What are my options?
http://domain.com/0001.php
http://domain.com/0002.php
http://domain.com/0003.php
...
http://domain.com/1000.php
Each of the above pages has a resubmit() javascript function triggered by a href. How can I automate triggering these?
Example:
<form action="/resubmit" method="POST">
<input type="hidden" name="security_token" value="SUPER-LONG-HASH">
<input type="hidden" name="url" value="http://mysite.com/0001.html">
<input type="hidden" name="redirect" value="long-string">
<script type="text/javascript">
window["resubmit"] = function () {
document["resubmit"].submit();
return false;
}
</script>
<a href="javascript:resubmit()" class="resubmit-class">resubmit</a>
</form>
I’m on a Mac. Unix, Perl, Bash, PHP, Automator, FireFox iMarcos are all available.
I already voted up the other answers, but in the end I wound up using straight AppleScript. This was helpful because it used an existing session so I didn’t have to deal with any authentication problems. Thanks for all of your help, everyone. I look forward to becoming familiar with the tools you shared.