I
I
IvanSkor2020-06-28 02:47:12
Google Chrome
IvanSkor, 2020-06-28 02:47:12

How to click a button at a specific time?

Hello, how can I set a command in the browser console so that a button is pressed on the site at a certain time (up to a second)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anastasia, 2020-06-28
@IvanSkor

You can get the time difference between then and now and set this time period to a timer. As soon as this time passes, the function will be executed.

// Точное время, когда выполнить команду
var whenDate = new Date(2020, 5, 28, 9, 0, 0, 0); // 28 июня 2020 г. 09:00:00.000 (9 утра)
// Точное время сейчас
var nowDate = new Date();

// Ставим таймер, который нажмёт на зелёную кнопку
// на сайте Тостер "Задать вопрос" ровно в 9 утра.
setTimeout(function() {
    document.querySelector(".btn_add-question").click()
}, whenDate-nowDate);

I
IvanSkor, 2020-06-28
@IvanSkor

Is it possible to somehow make it so that the time the button was pressed is simply indicated? Without present time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question