Doubt about Selenium and python

Asked

Viewed 38 times

0

I’m making a bot for instagram, comes certain part of the page I have a list of people with the "follow" button on the side.

made that code:

bot = self.bot
        bot.get('https://www.instagram.com/explore/people/suggested/')
        time.sleep(3)
        for i in range(1, 30):
            time.sleep(5)
            seguir = bot.find_element_by_tag_name("button")
            seguir.click()
            time.sleep(5)
            bot.refresh()

With each click of the button "follow", the bot gives a refresh on the page, who followed it some of the page and who is in 2 place rises to 1 and so the bot clicks again. The problem is that when it reaches the 5 or 7 person, the Buga button, it no longer clicks and loops. Below is the screenshot of the list I receive: inserir a descrição da imagem aqui

There’s no way around that problem?

  • which error returns?

  • none. that’s the problem, when it reaches the 7 or 9 person, it starts to click, refresh and when the page reloads the same person is still there, as if it had not been followed, and then starts to stay in this loop.

  • 1

    there is the method find_elements_by_tag that returns a array of the elements and the iteira they in a for

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.