(async () => { const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms)); for (let i = 0; i < 10000; i++) { document.getElementsByClassName('main-btn')[0].click(); await delay(5); // 5 ms sleep } })();