This will print the same name multiple time, rather than waiting for the page reload. How can I make sure the new value of 'name' gets printed after refresh?
for(var i = 1; i < 10; i += 1) {
document.querySelector("img[id='buttonReload']").click();
setTimeout(window.location.reload, 1000);
m = document.querySelector("a[id='name']").innerText;
console.log(m);
}