mardi 6 mars 2018

How to open multiple webdriver python programs at the same time with pytest?

I have 3 python scripts(3 web drivers). I would like to open these 3 scripts at the same time. I installed the packages(pip install pytest, pip install pytest-xdist) Now it opens test_one.py and then test_two.py and then test_three.py when I type pytest -n 5. I attached these 3 scripts:test_one.py, test_two.py, test_three.py. I will appreciate any help.

test_one.py

from selenium import webdriver

driver = webdriver.Chrome(executable_path="C:\\Users\Andrei\Downloads\chromedriver_win32\chromedriver.exe")
links=['https://ro.wikipedia.org/wiki/Emil_Constantinescu','https://ro.wikipedia.org/wiki/Traian_B%C4%83sescu','https://ro.wikipedia.org/wiki/Napoleon_I']
for i in range(len(links)):
    driver.get(links[i])

test_two.py

from selenium import webdriver

driver = webdriver.Chrome(executable_path="C:\\Users\Andrei\Downloads\chromedriver_win32\chromedriver.exe")

links=['https://ro.wikipedia.org/wiki/Abraham_Lincoln','https://ro.wikipedia.org/wiki/Winston_Churchill','https://ro.wikipedia.org/wiki/Mihail_Gorbaciov']
for i in range(len(links)):
    driver.get(links[i])

test_three.py

from selenium import webdriver


driver = webdriver.Chrome(executable_path="C:\\Users\Andrei\Downloads\chromedriver_win32\chromedriver.exe")

links = ['https://ro.wikipedia.org/wiki/Gabriela_Firea', 'https://ro.wikipedia.org/wiki/Ion_Iliescu',
         'https://ro.wikipedia.org/wiki/Mihai_Eminescu']
for i in range(len(links)):
    driver.get(links[i])

Aucun commentaire:

Enregistrer un commentaire