Hi I try to open parallely multiple instances of Chrome in python using Webdriver and Multiprocessing. After running processes, instances are opening smoothly, but they are not sent to my "instance" array and I can't access instances after that. Please help me, there is my code:
from selenium import webdriver
from multiprocessing import Process
import time
num = 3
process = [None] * num
instance = [None] * num
def get():
for i in range(num):
try:
instance[i].get("https://www.youtube.com")
except:
print("Can't connect to the driver")
time.sleep(1)
get()
def create_instance(i):
instance[i] = webdriver.Chrome()
if __name__ == '__main__':
for i in range(num):
process[i] = Process(target = create_instance, args = [i])
process[i].start()
for i in range(num):
process[i].join()
get()