Enter values and click the button automatically at the established time

0

I have a website with a little screen with a login form.

And my idea is to schedule automatic login for such a time.

For example, I want to have a simple way to change the code as well.

The idea is this:

When giving 18:00 at night or other time I inform in the code, the site load with my login and password and automatically click on the submit.

How can I do this? Really you are finding my intention strange and will say it is not safe etc, but I want to make a macro style to edit a site that I already have using the element inspection and there to adjust.

But in the current situation, I want to do with my website shown below:

   <!DOCTYPE html>
<html>
<head>
<title> Teste macro </title>
</head>
<body>
<p> Login: </p>
<input type="text" name="txtLogin"/></input>
<p> Senha: </p>
<input type="password" name="txtSenha"/>
<br>
<br>
<input type="submit" name="btSubmit"/>
</body>
</html>

I'm not able to dock the html directly here on the screen where you can put css, html, etc, it's crashing on my pc.

What path should you take to create this macro?

    
asked by anonymous 15.04.2015 / 21:09

1 answer

1

I imagine you have to loop to test the schedule, if it is the schedule fill in the fields and give a submit in the form.

var horario = {
        hora: 18,
        minutos: 0
    },
    login = {
        email: "[email protected]",
        senha: "secret"
    }
    input_email = document.getElementById("input_email"),
    input_senha = document.getElementById("input_senha"),
    form = document.getElementById("meu-form");


// Executa a função a cada segundo e guarda o identificados do Interval (caso seja necessário cancelar o timer)
var timer = setInterval(function(){
    var now = Date.now();

    if( now.getHours() === horario.hora && now.getMinutes() === horario.minutos) {

        clearInterval(timer);

        input_email.value = login.email;
        input_senha.value = login.senha;
        form.submit();
    }

}, 1000);
    
15.04.2015 / 22:49