There is a page on my site where I can parse specific magazines by filling out the form fields and clicking the submit button. Sometimes I have to parse 100 different logs (which are automatically uploaded to my site from another FTP location), so I'm trying to make it as automatic as possible. I created a file on my local computer called log.html with this content
<form action="MYSITEURL" method="POST" target="_blank" >
<input type="password" name="password" value="MYPASSWORD"/>
<input type="text" name="LogCommand" value="NAME-OF-THE-LOG-AND-LOCATION"/>
<input type="submit" value="Submit1stLog" />
</form>
When I open the log.html file on my local PC, it opens using Firefox, and I can see 2 fields that are automatically populated with a password and other information that I need about the names and commands of the log file, and I have a Send button " When I manually click "Submit", a local file connects to my website and sends these values and sends it. Basically, I fill out the form locally, and do not go to my site. Thus, I can have 100 lines, as described above, in one local HTML file and press 100 submit buttons manually, instead of going to my site 100 times.
My goal is to have some kind of JavaScript or something similar that will automatically click the submit button for me as soon as I open the local log.html file. Is it possible? What if I have a submit button?
I tried putting the following in log.html, but that didn't work
<form action="MYSITEURL" method="POST" target="_blank" > <input type="password" name="password" value="MYPASSWORD"/> <input type="text" name="LogCommand" value="NAME-OF-THE-LOG-AND-LOCATION"/> <input type="submit" id="Submit1stLog" value="Submit1" /> </form>
<script>
function clickButton()
{
document.getElementById('Submit1stLog').click();
}
</script>
If you notice, I added the id = "Submit1stLog" part, and then tried to get the item id. It didn’t work, and I'm terrible if you noticed that any help is appreciated!
Thank.
source
share