Answer the question
In order to leave comments, you need to log in
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
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);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question