let btns = document.querySelectorAll("[data-testid]")
let unfollowBtns = Array.from(btns).filter(btn => {
return btn.getAttribute('data-testid').includes('unfollow')
})
for (let i = 1; i <= unfollowBtns.length; i++) {
setTimeout(() => {
unfollowBtns[i-1].click()
setTimeout(() => {
document.querySelector("[data-testid='confirmationSheetConfirm']").click()
}, 500);
}, 1000 * i);
}
Maybe Im not aware how things work in Javascript client side. If I try, at the end of the loop, to include something like:
window.scrollTo(0, document.body.scrollHeight);
and insert everything inside another loop, everything appears to happen at the same time.
Any suggestions? Thanks.