Reputation: 32321
I am trying to achieve a stress test on my Web Application with the help of the below code.
I observed that the same code below is working to some extent in Firefox (but not great), but not at all working with Chrome.
The version of chrome I am using is Version 28.0.1500.95 m
<html>
<head>
<script type="text/javascript">
function test() {
var myStringArray = ["erer", "rerere"]
var len = myStringArray.length;
var windowCounter = 1; // make sure you declare this globally
for (var i=0; i<len; ++i) {
setTimeout(function() {
document.inform.target = windowCounter++; // a different target each time
document.inform.cid.value=myStringArray[0];
document.inform.pw.value="xxxxxxxx";
document.inform.submit();
}, i*10000); // change 1000 to the interval you need in milliseconds
}
}
</script>
</head>
<body>
<form name="inform" method="post" target="newWin" action="http://10.xx.xxx.xxx:8080/logon">
<input type="text" name="cid" >
<input type="password" name="pw" />
<input type="hidden" name="throttle" value="999" />
<input type="submit" value="go" onclick="test()">
</form>
</body>
</html>
Thanks in advance.
Upvotes: 0
Views: 88
Reputation: 359786
Non-ajax form submissions trigger a full page load, so you can't rely on any JavaScript executing after that point. Use ajax to submit the form instead.
Upvotes: 1