Estoy tratando de hacer un código JavaScript que se inyecte en cpstest.org y cuando hace clic en el botón de inicio, automáticamente comienza a hacer clic automáticamente. Traté de hacer un guión para ello, pero simplemente no funcionó.
El botón de inicio tiene id de inicio pero no sé el elemento para hacer clic. Sería útil ver el código fuente o usar herramientas de desarrollo, pero están bloqueadas en mi computadora.
let i = 1; document.querySelector('#start').addEventListener('click', function() { i = 0; }); function repeat() { if (i == 0) { document.querySelector(unknownId).click()}; requestAnimationFrame(repeat) } }; repeat();Aquí hay una solución:
// speed - how many CPS you want // duration - how long the test is (in seconds) const rapidClick = (speed, duration) => { const startButton = document.querySelector('button#start'); const clickArea = document.querySelector('div#clickarea'); // Start the test startButton.click() // Click the clickArea on an interval based on the "speed" provided const interval = setInterval(() => clickArea.click(), 1e3 / speed); // Clear the interval after the duration has passed setTimeout(() => clearInterval(interval), duration * 1e3); } // Do 100 CPS for 5 seconds rapidClick(100, 5) Noté que incluso al configurar el parámetro de speed en algo loco como 1000 CPS, la prueba dice solo 133-139 clics por segundo. Parece que termina en 139. Espero que esto ayude.