// Function to click on a span based on specific text content
function clickSpanByText(textContent) {
const spans = document.querySelectorAll('span');
let clicked = false;
spans.forEach(span => {
if (span.textContent.trim() === textContent) {
span.click();
console.log('Clicked on:', span);
clicked = true;
}
});
return clicked;
}
// Handler for managing the sequence of clicks
function handleSpanClicks() {
if (clickSpanByText("13.18")) { // DATUM
// Check other span texts as the next target
const times = ["14:20", "14:40", "19:40"]; // TIJDEN
for (let time of times) {
if (clickSpanByText(time)) {
console.log('Successfully clicked on:', time);
clearInterval(intervalID); // Stop the interval after successful click
return; // Exit the function
}
}
}
}
// Set an interval to run the handleSpanClicks function every 2000 milliseconds (5 seconds)
let intervalID = setInterval(handleSpanClicks, 2000);