Home > other >  Making a bot execute a set of actions simultaneously in Python (Using selenium)
Making a bot execute a set of actions simultaneously in Python (Using selenium)

Time:10-01

I made a bot with Selenium that opens a browser and fills with the data of a different person a form for each person I have on a list (or dictionary, not important here) (it opens a browser with a different proxy each time).

I'd like to make it to open, let's say if I have 10 people in that list, then open 10 browser windows and complete them at the same time, each one with the data of a different person from that list.

My bot works fine, it just executes one cicle at a time (opens a browser and completes one form, then opens another browser and completes it, then another and so on)

How should I approach this? What should I take in consideration? (I guess it might take more ressources) Should I do that? Is there any efficient way to achive that?

Thank you!

CodePudding user response:

Try using some basic multi-threading. I recommend this guide by Jim Anderson:

An Intro to Threading in Python

Edit: Remember to not interact with one variable using two different threads.

  • Related