I wanted to unlike all liked tweets on Twitter. Since react is developed using tweeter I wanted to do that thing with code. I found the beloved code in Github which we should run on the developer console.
setInterval(() => {
for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
d.click()
}
window.scrollTo(0, document.body.scrollHeight)
}, 1000)
so this code will run once in every 1000 ms and I will scroll by itself. But I wanted to know the use of data-tested here why he didn't use normal class or id to select tweet like button? What is the difference between data-testid and id?
this is the image of the tweet unlike component