Runizag,
(async () => {
const values = [
//hh:mm:ss text
['10:20:00', '12'],
['20:30:00', '34'],
];
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
while (true) {
const date1 = new Date();
const time1 = date1.toLocaleTimeString('ru');
const value = values.find(value => value[0] > time1);
if (!value) break;
const date2 = new Date(Number(date1));
date2.setHours(...value[0].split(':'), 0);
await delay(date2 - date1);
const textInput = document.querySelector('#g-search input[type=text]');
textInput.value = value[1];
const findButton = document.querySelector('#g-search button[type=button]');
findButton.click();
await delay(5000);
const selectButton = document.querySelector('selector?');
if (selectButton) selectButton.click();
}
})();
|