I'm trying to auto-submit (login) form (datas are remebered by browser) via JavaScript on one specific webpage. I managed to submit test form that I made on my PC very easy using this:
document.forms["formID"].submit();
But when I try that on page it fails. I run JavaScript on page by Greasemonkey and it works fine, run alerts etc. but submit isn't working. Webpage is: http://plusklub.hteronet.ba/Login
I tried to w8 for load with this part of code
document.addEventListener("DOMContentLoaded", function(event) {
document.forms["aspnetForm"].submit();
});
Also was using this code from top comment on this question Auto-Submit Form using JavaScript Fail means nothing happens.
A few things I tried:
console.log("test1");
document.addEventListener("DOMContentLoaded", function(event) {
console.log("test2");
});
console.log("test3");
window.onload = function () {
console.log("test4");
}
}
console.log("test5");
var fo=document.getElementById("aspnetForm");
console.log(fo);
var bu=document.getElementsByClassName("button");
console.log(bu);
bu.click();
setTimeout(function(){ console.log("test6"); }, 3000);
Output folowing:
test1helloworld.user.js:13:3
test3helloworld.user.js:17:3
test5helloworld.user.js:22:3
<form name="aspnetForm" method="post" action="/Login?ReturnUrl=http://plusklub.hteronet.ba/" id="aspnetForm">helloworld.user.js:24:3
HTMLCollection [ <input#ctl04_ctl02_btnSubmit.button> ]