var script = document.createElement('script');
script.type = "text/javascript";
script.src="https://code.jquery.com/jquery-3.5.1.min.js";
document.head.appendChild(script);
var t = 0;
$.each($("button"), function(i,v){
if($(v).text() == "Кнопка ")
{
setTimeout(function(){
$(v).click();
}, t);
t+=5000
}
});
const script = document.createElement('script');
script.type = "text/javascript";
script.src="https://code.jquery.com/jquery-3.5.1.min.js";
document.head.appendChild(script);
let time = 0;
const buttons = $("button");
eachButtons();
function eachButtons() {
$.each(buttons , (index, button) => {
const text = $(button).text();
if(text.includes("Кнопка ")) {
clickButton(index, button, time);
time+=1000;
}
});
}
function clickButton(index, button, t) {
setTimeout(function(){
$(button).click();
console.log($(button).text())
if (index === buttons.length - 1) {
time = 1000;
eachButtons();
}
}, t);
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const btns = [...document.querySelectorAll("button")];
const filteredBtns = btns.filter(btn => btn.textContent.startsWith("Кнопка"));
for (const btn of filteredBtns) {
btn.click();
await sleep(5000);
}