The folder contains 50 simple tests written in python3. When you run them one by one

for i in `ls /path/*.py`; do python3 $i; done 

Each time the browser opens. Is there any way to do this so that all these scripts run in one browser?

An example of a simple script:

 from selenium.webdriver.firefox.webdriver import WebDriver success = True vd = WebDriver() #АДРЕС САЙТА ДЛЯ ПОСТИНГА urlnow = "http://www.google.ru" #ОТКРЫВАЕМ URL vd.get(urlnow) vd.quit() 

    1 answer 1

    It's simple)))))

    You make a control script that has a for loop and nothing else. And you take executable scripts in each of which (among other things) there is an import library, a browser launch command and a browser close command

     from selenium.webdriver.firefox.webdriver import WebDriver vd = WebDriver() vd.quit() 

    This means that you have to import the browser library , turn on the browser and turn off the browser inside the loop . So you have this construction:

     ЦИКЛ: запуск.браузера тело цикла выключение.браузера 

    That is why the browser starts and stops each iteration of the cycle.

    So that this does not happen, you need to take out the import of the library, launch and shutdown in a cycle, that is, write them in the control script as a structure:

     запуск.браузера ЦИКЛ: тело цикла выключение.браузера 

    This means that you need to edit all 50 executable scripts, and delete the startup and shutdown commands of the browser, and the library import and these commands need to be written in the control script.