'Sometimes Chrome Web Driver is not loading link using Selenium Python

hope you all are fine. I'm opening a link using this code,

def load_url():
    driver = webdriver.Chrome()
    driver.get(url)

def scrap_matches(urls):
    for url in urls:
        load_url(url)

Use Case: I'm using a list of urls and passing them one by one to "load_url" function.

I'm using multithreading i.e. There are 4 threads and each thread is working on a list of urls like this,

# part_1 and part_2 are the lists.
t1 = threading.Thread(target=scrap_matches, args=(part_1,))
t2 = threading.Thread(target=scrap_matches, args=(part_2,))

t1.start()
t2.start()
t1.join()
t2.join()

Sometimes an empty chrome tab opens without loading any content of page. Link is present in link portion of chrome. When I refreshes that tab manually then website loads successfully. I need to avoid this situation. I have searched about it but could not find any satisfactory answer.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source