So, on the website, there's a button after which you click, there appears a new popup that also has a button. What I am trying to achieve is that by javascript, I wanna click the first button and when pop-up appears, i want to click on that another button.
Code:
var arr = document.getElementsByClassName("firstButtonClassName");
for (var i = 1, len = arr.length; i < len; i++) {
arr[i].click();
console.log(document.getElementsByClassName("popupButtonClassName"))
}
with the above code, first button is clicked fine and popup appears, but as you can see, console log above prints empty array instead of the array that contains popup's button..
Is there some trick I don't understand ?