I am trying to execute a small piece of javascript on a URL, then set a 10 second interval timer to change URL and load another page and then execute that same piece of code... but after the new page loads, the script stops... is there a way to keep the script running on a global level ? or possibly an alternative solution that can provide me with the same result? maybe an automation software that is free and allows this? I want to startup on this as part of testing scenario but I m new to this
this is my code that I m putting in the console I would like to run the getStuff on the 1st loaded page, then redirect, then run it again on the 2nd page
function getStuff(){
var innerHtml = document.getElementById( carInfo ).innerHTML;
console.log(innerHtml);
}
function redirect() {
location.href = http://localhost/details.php?id=2; // go to 2nd page, want to increment the id as next step
setTimeout("getStuff()",5000); // wait 5 seconds to load, run getStuff
}
getStuff(); // getStuff() the 1st time (current open page)
var interval = setInterval("redirect()",10000); // redirect() after 10 seconds to a new url then getStuff...loop on this