TransWikia.com

Direct code execution through the JS browser console

Stack Overflow Asked by Matheus Nascimento on February 10, 2021

I’m trying to run the code below, and it works perfectly up to the 12th item …

In this case I created this script to like a post on Facebook in pure JS, but as I said, when it arrives at item 12 it stops clicking on the element "document.querySelector (‘. Q9uorilb.sf5mxxl7.bdca9zbp’). Click ()" that is the query that gives like

Does anyone know what can it be? Is it some limiting feature of Facebook likes maybe?

codic

var likes = 0;
var time = 10000
document.querySelectorAll('.l9j0dhe7.soycq5t1').forEach((item, index) => {
  setTimeout(() => {
    item.click()
    setTimeout(() => {
      document.querySelector('.q9uorilb.sf5mxxl7.bdca9zbp').click()
    }, 9000)
    likes++; //+1 "likes"
    console.log(`You liked a total of $ {likes} posts!`);
    if (likes == 10) return time = 30000
    else if (likes == 20) return time = 50000
    else if (likes >= 30) return time = 80000
  }, index * time)
})

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP