Wednesday 22 November 2017

multithreading - How do I run the same Python script X amount of times simultaneously?

I have created a Python script that I want to execute
multiple times - at the same time. How do I do
this?



I am writing automation scripts in Python
(using Selenium chromedriver) and have a script that goes to a website and creates an
account. I want to create some kind of batch file that executes this script an X amount
of times simultaneously so that I can create more than one account at once on this
website.



Ideally, I would like an input when the
program starts that asks how many accounts you would like to create, and then the input
is how many simultaneous scripts will be run.
E.g.



import os 
number =
input("How many guest users do you want to create? ")
run_test =
os.system('python create_guest_user.py')

number =
int(number)

# run the 'create_guest_user.py' script 'number' amount
of times simultaneously
# (unsure on how to do this
part)


I am unsure on
the methods needed to execute this process.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...