Using python, if you want to loop code from an other script (GuiTest.py
) without ever modifying it you have two solutions depending on the situation:
1.You know nothing about the script and just know that it can be ran:
import os
for i in range(X):
os.system("python GuiTest.py")
That will launch a brand new python interpreter and run the script as you would do it by hand
2.You know how the code looks like and what you want to loop is enclosed in a function or a few functions
import GuiTest
for i in range(X):
GuiTest.function_to_loop()
#if you have to run more than one function per loop:
#GuiTest.other_function_to_loop()
This has the advantage of initializing the script only once (doing the imports etc...) and then only loop the actual code. With selenium
it can be interesting because the browser can take a while to start.