# 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
    chrome_options.add_argument('--ignore-certificate-errors')
    chrome_options.add_argument('--ignore-ssl-errors')
    chrome_options.add_argument('--disable-gpu')
    chrome_options.add_argument('--no-sandbox')
    prefs = {'profile.managed_default_content_settings.images': 2}
    chrome_options.add_experimental_option('prefs', prefs)
    return chrome_options


def create_chrome_driver():
    driver = Chrome(options=make_chrome_options())
    driver.set_page_load_timeout(10)
    driver.set_script_timeout(10)
    driver.implicitly_wait(10)
    return driver


def reopen_chrome_thread(sem):
    driver = None
    try:
        driver = create_chrome_driver()
        driver.get(TEST_URL)
    except Exception as e:
        print(e)
    finally:
        if driver:
            driver.quit()
        sem.release()



# 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

    chrome_options.add_argument('--ignore-certificate-errors')
    chrome_options.add_argument('--ignore-ssl-errors')
    chrome_options.add_argument('--disable-gpu')
    chrome_options.add_argument('--no-sandbox')
    prefs = {'profile.managed_default_content_settings.images': 2}
    chrome_options.add_experimental_option('prefs', prefs)
    return chrome_options


def create_chrome_driver():
    driver = Chrome(options=make_chrome_options())
    driver.set_page_load_timeout(10)
    driver.set_script_timeout(10)
    driver.implicitly_wait(10)
    return driver


def reopen_chrome_thread(sem):
    driver = None
    try:
        driver = create_chrome_driver()
        driver.get(TEST_URL)
    except Exception as e:
        print(e)
    finally:
        if driver:
            driver.quit()
        sem.release()



@log_time('reopen chrome')