# Path: benchmarks/utils.py
# def log_time(name):
#     def wrapper(func):
#         def run(*args, **kwargs):
#             start = time.time()
#             res = func(*args, **kwargs)
#             print('The execution time of {}: {}'.format(name, time.time() - start))
#             return res
# 
#         return run
# 
#     return wrapper


from threading import Thread, Semaphore
from collections import deque
from selenium.webdriver import Chrome, ChromeOptions
from benchmarks.utils import log_time
        self.available_drivers = deque()

    def get_driver(self):
        try:
            driver = self.available_drivers.popleft()
        except IndexError:
            driver = create_chrome_driver()
        return driver

    def push_driver(self, driver):
        self.available_drivers.append(driver)

    def close(self):
        try:
            while True:
                driver = self.available_drivers.popleft()
                try:
                    driver.quit()
                except Exception:
                    pass
        except IndexError:
            pass


def reset_driver(driver):
    assert isinstance(driver, Chrome)
    driver.execute_script('window.open();')
    handles = driver.window_handles
    for i in range(0, len(handles) - 1):
        driver.switch_to.window(handles[i])

# Path: benchmarks/utils.py
# def log_time(name):
#     def wrapper(func):
#         def run(*args, **kwargs):
#             start = time.time()
#             res = func(*args, **kwargs)
#             print('The execution time of {}: {}'.format(name, time.time() - start))
#             return res
# 
#         return run
# 
#     return wrapper


# Path: benchmarks/chrome_driver_manage_benchmark.py
from threading import Thread, Semaphore
from collections import deque
from selenium.webdriver import Chrome, ChromeOptions
from benchmarks.utils import log_time

        self.available_drivers = deque()

    def get_driver(self):
        try:
            driver = self.available_drivers.popleft()
        except IndexError:
            driver = create_chrome_driver()
        return driver

    def push_driver(self, driver):
        self.available_drivers.append(driver)

    def close(self):
        try:
            while True:
                driver = self.available_drivers.popleft()
                try:
                    driver.quit()
                except Exception:
                    pass
        except IndexError:
            pass


def reset_driver(driver):
    assert isinstance(driver, Chrome)
    driver.execute_script('window.open();')
    handles = driver.window_handles
    for i in range(0, len(handles) - 1):
        driver.switch_to.window(handles[i])

        driver.close()