def delete_cache(): cache = CacheManager() cache_path = cache.get_cache_path() if os.path.exists(cache_path): os.chmod(cache_path, 0o777) shutil.rmtree(cache_path) sleep(5)
def __init__(self): self._file_manager = CacheManager(to_folder=config.folder, dir_name=config.folder)
import os import shutil from time import sleep import pytest from webdriver_manager.cache import CacheManager from webdriver_manager.driver import ChromeDriver, FireFoxDriver cache = CacheManager() def delete_cache(): cache_path = cache.get_cache_path() if os.path.exists(cache_path): shutil.rmtree(cache_path) sleep(5) @pytest.mark.parametrize("os_type", ["linux64", "linux32", "mac64", "win32"]) def test_can_download_chrome_driver_for_os(os_type): delete_cache() name = "chromedriver" version = "2.26" url = "http://chromedriver.storage.googleapis.com" driver = ChromeDriver(driver_url=url, name=name, version=version, os_type=os_type) binary = cache.download_driver(driver)
import os import shutil from time import sleep import pytest from webdriver_manager import config from webdriver_manager.cache import CacheManager from webdriver_manager.config import Configuration from webdriver_manager.driver import ChromeDriver, GeckoDriver cache = CacheManager(to_folder=config.folder, dir_name=config.folder) def delete_cache(): cache_path = cache.get_cache_path() print("Delete cache folder {}".format(cache_path)) if os.path.exists(cache_path): shutil.rmtree(cache_path) sleep(5) @pytest.mark.parametrize("os_type", ["linux64", "linux32", "mac64", "win32" ]) def test_can_download_chrome_driver_for_os(os_type): delete_cache() driver = ChromeDriver(version="2.26", os_type=os_type)
def __init__(self): self._file_manager = CacheManager()