Home > database >  Program stuck at creating driver instance
Program stuck at creating driver instance

Time:02-10

I have program that uses threading that opens several drivers same time and all doing different search online. But when I start running the program, some driver work fine, but some driver will stuck at the creating driver instance stage.

Those drivers just stuck there forever.

This is the code that those drivers stopped:

browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)

Any idea that what went wrong? Or what are the ways to find out what went wrong? Since the program stuck there, I don't know how to get the error from it. The Whole function that create drivers as follows:

for driver_threads in range(Driver_Count):
    Driver_Creation = Thread(target=createDriverInstance,args=(driver_threads,"Hide"))
    Driver_Creation.start()

def createDriverInstance(driver_threads, display):
    chrome_options = Options()
    chrome_options.binary_location=chrome_binary_location # I have declare the location somewhere
    if(display=="Hide"):
        chrome_options.add_argument('--headless')
        chrome_options.add_argument('--disable-gpu')
    chrome_options.add_argument("--log-level=3")
    chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
    browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
    return browser

CodePudding user response:

Change the current browser variable To :

browser =  webdriver.Chrome(options=chrome_options)

This I think it is because it is trying to download chromedriver So :)))

  • Related