I have x - pages of lists of 15 objects each. I would like to go through all the pages downloading the text of each of the 15 items in the list. The download works, but the same elements are written to the variable "a" (probably because the code executes faster than clicking from within the code). Is it possible to put it to sleep / wait for execution and then go to the next page?
var a = '';
for (let i = 0; i < 999; i++) {
const paragraphs = document.querySelectorAll(".my-object-on-list");
paragraphs.forEach(p => a = a + p.outerText);
angular.element(document.getElementsByClassName('btn-forward')).click();
setTimeout(1);//sleep for 1s?
}