I am getting a list of URLs by gettig the href attribute from an array of elements that match a certain class name. Everything works great until here. Then I am trying to change the location.href of the page, every 10 seconds, by iterating on the array of URLs. For some reason, nothing happens though. What am I doing wrong?
var buttonsElements = document.getElementsByClassName("elementor-button-link elementor-button");
console.log(buttonsElements.length);
for(i=0;i<buttonsElements.length;i++) {
console.log(buttonsElements[i].href);
//everything works just fine until here
setTimeout(function(){
window.location.href = buttonsElements[i].href;
},10000);
}